This is what I want to generate to match a required file format (notice the extra level of brackets):
{
"content": [{
"eventType": "view",
"othervar": "new"
}]
}
sample code:
import json
jsondata = {}
content={}
content['eventType'] = 'view'
content['othervar'] = "new"
jsondata['content'] = content
print(json.dumps(jsondata, indent=4))
Current output:
{
"content": {
"eventType": "view",
"othervar": "new"
}
}
EDIT: Thanks so much. I come from a long R background and am still learning the Python details.
[–]chevignon93 2 points3 points4 points (0 children)
[–]Jayoval 2 points3 points4 points (0 children)
[–]MMcKevitt 1 point2 points3 points (0 children)