LeeJinHee LeeJinHee - 1 year ago 89
JSON Question

How to get value using key in python multi dictionary

"card_quota": 0,
"custom_data": "{\"child_name\":\"홍설\",\"uid\":\"29\",\"lid\":\"56\",\"count\":\"1\",\"schedule\":\"2016-06-18(토)\"}",
"escrow": false

This is dictionary type of python. I konw to get value using a code like temp['card_quata']. But i want to know using key in ['custom_data'] getting value like child_name or uid .. How can i do that?

Answer Source

You can parse custom_data with json.loads and then access the returned dict:

>>> import json
>>> json.loads(temp['custom_data'])['child_name']

Note that the example data you provided is not valid Python since Python uses False instead of false.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download