This JSON output is from a MongoDB aggregate query. I essentially need to parse the nested data JSON down to the following to the 'total'
and '_id'
values.
{
'ok': 1.0,
'result': [
{
'total': 142250.0,
'_id': 'BC'
},
{
'total': 210.88999999999996,
'_id': 'USD'
},
{
'total': 1065600.0,
'_id': 'TK'
}
]
}
I've tried 5 different techniques to get what I need from it, however I've run into issues using the json
and simplejson
modules.
Ideally, the output will be something like this:
142250.0, BC
210.88999999999996, USD
1065600.0, TK
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…