Got an array with objects called data
that looks something like this:
[
{
'type': 'motorcycle',
'properties': [
{
'type': 'large',
'brand': 'kawasaki',
'attribute': {
'id': '98-fda7d7fa',
'title': 'Ninja'
},
}
]
}
[
I can output a json file like this:
with open('output.json', 'w') as f:
print(data, file=f)
but it comes out with single quotes and not double quotes,
so I can't really automatically format it on my code editor
I am trying to follow the top voted answer to fix that:
with open('output.json', 'w') as f:
print(json.load(data), file=f)
But I get this error:
AttributeError: 'list' object has no attribute 'read'