I'm trying figure out how to load file called foo.json with this content:
[
{
"bar1": "foobar1-1",
"bar2": "foobar1-2",
"bar3": "foobar1-3"
},
{
"bar1": "foobar2-1",
"bar2": "foobar2-2",
"bar3": "foobar2-3"
}
]
Code I've tried:
with open('foo.json') as data_file:
print(data_file)
data = json.load(data_file)
print(data)
Everything I've seen parsing json with json.load seems to be geared toward dictionary content but this json represents an array of objects or an array of dictionaries. Json.load does not seem to even work with a array of dictionaries. Perhaps I need to use a different json parsing library for this. Any help is appreciated.