home..

python-json-notes

python

Intro

JSON to python object

with open('data.json', 'r') as file:
	data = json.load(file)
json_string = '{"name":"John", "age":"32"}'
data = json.loads(json_string)

python object to JSON

data = '{"name":"John", "age":"32"}'
with open('data.json', 'w') as f:
	json.dump(data, f, indent=4)
© 2025 Jithendra Yenugula