How can I get the parent of the element in JSON? For example, In the JSON below,
When I use print(json["phones"])
, the result I want to happpen is:
[iphone1, iphone2]
but instead, I am getting this:
{'iphone1': {'test': ''}, 'iphone2': {'test': ''}}
Sorry I am new on python and JSON, the sample code is below. Thank you!
{
"phones":
{
"iphone1":
{
"test": ""
},
"iphone2":
{
"test": ""
}
}
}