Answer the question
In order to leave comments, you need to log in
How to add object to json list?
I have this json:
{
"items": [
{
"start_price": "5000",
"end_price": "4750",
"classid": "310781333",
"instanceid": "302028390",
"name": "P90 | Teardown (Field-Tested)"
}
]
}
{
"items": [
{
"start_price": "5000",
"end_price": "4750",
"classid": "310781333",
"instanceid": "302028390",
"name": "P90 | Teardown (Field-Tested)"
}
{
"start_price": "3000",
"end_price": "2750",
"classid": "310781533",
"instanceid": "302015782",
"name": "Souvenir MP5-SD | Lab Rats (Field-Tested)"
}
]
}
Answer the question
In order to leave comments, you need to log in
d = json.loads(json_string)
d["items"].append({
"start_price": "3000",
"end_price": "2750",
"classid": "310781533",
"instanceid": "302015782",
"name": "Souvenir MP5-SD | Lab Rats (Field-Tested)"
})
json_string = json.dumps(d)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question