How to parse python json object?
Currently i'm getting this value from another json file, it is a variable "Id6087b9b5b5" But what if i don't know the object string but i want to fetch "_number" in a loop?
try.py
for sub_dict in y[ChangeID]: #ChangeID is a variable
print (ChangeID)
MERGENUM = (entry['_number'])
print (MERGENUM
)
data.json
{
"Id6087b9b5b5": [
{
"status": "NEW",
"_number": 35328
}
],
"Id6087b9b345": [
{
"status": "NEW",
"_number": 35348
}
],
"Id6087b9b555": [
{
"status": "NEW",
"_number": 35310
}
],
"Id6087b9b5b4": [
{
"status": "NEW",
"_number": 35308
}
]
}
output as a variable
35328
35348
35310
35308
entry?entryis not defined in your code.