get JSON object attribute name

Posted by Laurent Luce on Stack Overflow See other posts from Stack Overflow or by Laurent Luce
Published on 2010-05-04T03:46:17Z Indexed on 2010/05/04 3:48 UTC
Read the original article Hit count: 214

Filed under:
|
|
|

I know that I can retrieve "session" by using item.fields.name but what if I don't know in advance that the attribute is called "name". How can I retrieve the list of the attributes names in fields first.

[
    {
        "pk": 2,
        "model": "auth.group",
        "fields": {
            "name": "session"
        }
    }
]

© Stack Overflow or respective owner

Related posts about JSON

Related posts about attribute