-1

I have the following json string:

{"response":[[{"uid":123456,"name":"LA_"}],[{"cid":"1","name":"Something"}],[{"cid":1,"name":"Something-else"}]]}

How can I get Something value? I do the following

jstr = json.loads(my_string)
if jstr.get('response'):
    jstr_response = jstr.get('response')[1].get('name')

but it doesn't work ('list' object has no attribute 'get')

LA_
  • 19,823
  • 58
  • 172
  • 308
  • It's a dictionary mapped to lists of lists of dictionaries: `(jstr.get('response')[1])[0].get('name')` – wkl Oct 27 '11 at 17:38

1 Answers1

3

Try this.

jstr = json.loads(my_string)
if jstr.get('response'):
    jstr_response = jstr.get('response')[1][0].get('name')
Shashi
  • 2,137
  • 3
  • 22
  • 37