Skip to content
Advertisement

For key and value in file json [closed]

FILE json

{
  "102": "868",
  "103": "8648",
  "104": "868",
  "105": "8468",
  "1026": "8468",
  "107": "8648",
  "108": "85468",
}

I want to make a loop for and get the key and value

Advertisement

Answer

looool [in python3.7]

import json
with open(path_to_your_json_file) as f:
    d = json.load(f)
    for k in d:
        print(k, d[k]) 
Advertisement