Learning memo / memorandum
JSON
A language that becomes a data exchange format between various programming languages. Even in Python, JSON can be handled using the json
package that is supported as standard.
import json
with open('test.json', 'r') as j:
data = json.loads(j.read())
import json
data = ['I love',
{'language': {'target': ['Python', 'Java', 'JavaScript']}},
{'alcohol': {'target': ['Beer', 'Wine', 'Whisky']}}
]
with open('test.json', 'w') as j:
j.write(json.dumps(data))
Recommended Posts