I want to append different values to the same dictionary structure inside a JSON list. Here is an example:
myJson = {"list": []}
element = {"value": []}
myJson["list"].append(element)
myJson["list"].append(element.copy())
myJson["list"][0]["value"].append("first")
myJson["list"][1]["value"].append("second")
print(myJson)
What this prints out is:
{'list': [{'value': ['first', 'second']}, {'value': ['first', 'second']}]}
But I want:
{'list': [{'value': ['first']}, {'value': ['second']}]}
What am I doing wrong? I created a copy of element
so why is it still the same? Thanks!