JSON is a very common data transfer format used both on web and desktop projects. In this post, we will share you most common concepts for reading and writing JSON format files.

How to read object data from a JSON file

import json

with open('data.json', 'r') as f:
  data = json.load(f)
  print(d)

How to write object data to JSON file

import json
with open('data.json', 'w') as f:
  json.dump(data, f)