In <b9f6b419-7923-4c51-ba0d-c3bed68b0...@googlegroups.com> 
mike.rei...@gmail.com writes:

> Im reading in a JSON file that looks like this
> ... snip ...
> Lets say I want to get the ID # of MyField1, how can I parse this with
> json lib? Theyre all on the same level, not sure how to target it to go
> to MyField1 and get "id" value. 

That data looks like a list of dictionaries:

    import json

    with open("json.dat", "r") as fp:
        data = json.load(fp)
        for item in data:
            if item['name'] == 'myField2':
                print item['id']

-- 
John Gordon                   A is for Amy, who fell down the stairs
gor...@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to