SyntaxFix
Write A Post
Hire A Developer
Questions
You build the object before encoding it to a JSON string:
import json data = {} data['key'] = 'value' json_data = json.dumps(data)
JSON is a serialization format, textual data representing a structure. It is not, itself, that structure.