Q:

How to use list update/insert key/value json object in python

I am trying update/insert for multiple json object into list dictionary.  Example: insert "state": "Kuala Lumpur" of "City": "Kuala lumpur" and "state": "Melaka" of "City": "Kuala sungai baru".  This is my code:
    import json
    j=[{"City": "Kuala lumpur",
    "Population (2000)": "1410300",
    "Latitude (DD)": "3.160",
    "Longitude (DD)": "101.710", 
    },
    {
            "City": "Kuala sungai baru",
            "Population (2000)": "11700",
            "Latitude (DD)": "2.350",
            "Longitude (DD)": "102.030"
    }]
    # how to update for key/value multiple json obj
    # how to insert for all json obj
    iter(j).next()['nation'] = u'malaysia' 
    #load json
    data= json.dumps(j)
    json_str= json.loads(data)
    #get key
    keys =[item['nation'] for item in json_str] # KeyError: ('nation',)

A:

This line
iter(j).next()['nation'] = u'malaysia'

is only updating the first entry in your structure. 
Try:
for it in j:
    it['nation'] = u'malaysia'

