I am new to Python and I am playing with JSON data. I would like to dynamically build a JSON object by adding some key-value to an existing JSON object.
I tried the following but I get TypeError: 'str' object does not support item assignment
:
import json
json_data = json.dumps({})
json_data["key"] = "value"
print 'JSON: ', json_data