Maybe this is what you want: from json import JSONDecoder s = '''{ "pk": 1, "model": "store.book", "fields": { "name": "Mostly Harmless", "author": ["Douglas", "Adams"] } } ''' d = JSONDecoder().decode(s)
print a['fields']['author'] On Tue, Nov 23, 2010 at 9:45 PM, alecx <alexander.robert.h...@googlemail.com> wrote: > Hello django users, > > after several try outs, i am not able to figure out how to access data > in a serialized object. > E. g. how do I get the name "Douglas", "Adams" in the example: > http://docs.djangoproject.com/en/dev/topics/serialization/#deserialization-of-natural-keys > > In javascript i can get e. g. the "name": "Mostly Harmless" with: > this.fields.name. > But how do i get the "author": ["Douglas", "Adams"]? > I tried serveral options, but had no luck. > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Best Regards! Li You University of Science and Technology of China -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.