Sep-14-2020, 01:15 AM
Lines 5-7 are indented improperly.
As the outer json object is a mapping, that loads into python as a dict. When you run
The way you parse the JSON depends on the actual data. The dict you are interested in is inside a list, inside another dict.
As the outer json object is a mapping, that loads into python as a dict. When you run
list()
on it, that returns only the keys of that dict (and there's only one key).The way you parse the JSON depends on the actual data. The dict you are interested in is inside a list, inside another dict.
content = json.load(f)['environment-sensor']