For the first time I work with Python, literally a couple of lines of code need to be written, for some system to work. The problem is this. There is a JSON-response from the server, I need to get the value of the field in it.

[{u'message': {u'chat': {u'first_name': u'Иван', u'id': 1, u'last_name': u'Иван', u'type': u'private', u'username': u'ivan'}, u'date': 1, u'entities': [{u'length': 6, u'offset': 0, u'type': u'bot_command'}], u'from': {u'first_name': u'Иван', u'id': 1, u'last_name': u'Иван', u'username': u'Иван'}, u'message_id': 2, u'text': u'/start'}, u'update_id': 1}] 

So, I need to get the value, for example, of the 'first_name' field. How do i get it? Here, I understand, a double list. If it were single, then I could get the value of the field first_name like this:

 response['first_name'] 

here it does not work out.

    1 answer 1

     response[0]['message']['chat']['first_name'] 
    • Thank you very much! :) - TheMatver pm