I have a JSON string (simplified version shown below), and I'd like to be able to format it to dynamically insert values into the "item" field:
"""{"a":[{"id":1,"item":{}},{"id":2,"item":{}}]}""".format(8,0)
I get KeyError: '"a"' when I do this, presumably because I need to escape all the other brackets. The actual json I have is quite a bit more complex, and it would be a pain to escape all the brackets. Is there an easier way to do this?