Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 372 Bytes

open_json_file.md

File metadata and controls

26 lines (20 loc) · 372 Bytes

How to open JSON file

import json
with open('/tmp/data.json') as f:
  obj = json.load(f)
  • /tmp/data.json - path to JSON file
  • json.load - parse json object in file and gives result in dictionary

group: json

Example

import json
with open('/tmp/data.json') as f:
  obj = json.load(f)
  print(obj)
{'test': 1}

group: json