Skip to Content
Menu
This question has been flagged
1 Reply
10031 Views

Hello everybody!!!

Can anyone help me know how to parse this json please:

[{"action": "update", "type": "contract_info", "data": {"param": "contract_wage", "value": 2500}}, {"action": "update", "type": "contract_info", "data": {"param": "contract_day_rate", "value": 115.36686663590216}}, {"action": "update", "type": "contract_info", "data": {"param": "contract_hour_rate", "value": 14.42085832948777}}, {"action": "update", "data": {"value": "oui", "param": "family_boss_ok"}, "type": "empolyee_info"}, {"action": "update", "data": {"value": "oui", "param": "family_boss_ok"}, "type": "empolyee_info"}]

Thanks a lot in advance.

Avatar
Discard
Author Best Answer

Here is the answer:

import json

with open('data.json') as f :

data = f.read()

jsondata = json.loads(data)

for count in jsondata:

print count['type']

print count['data']['param']

print count['data']['value']

Avatar
Discard
Related Posts Replies Views Activity
3
Apr 24
1026
0
May 24
46
1
Apr 24
1833
4
Sep 23
3086
2
Sep 23
5593