Answer the question
In order to leave comments, you need to log in
Why can't convert json to dictionary?
There is this Vkontakte API response:
{"response":{"count":1011,"items":[{"conversation":{"peer":{"id":-183235386,"type":"group","local_id":183235386},"in_read":1131663,"out_read":1131663,"last_message_id":1131663,"can_write":{"allowed":true},"current_keyboard":{"one_time":true,"author_id":-183235386,"buttons":},"can_send_money":true,"can_receive_money":false},"last_message":{"date":1561632212,"from_id":-183235386,"id":1131663,"out":0,"peer_id":-183235386,"text":"Очень жаль! Скажите, пожалуйста, почему Вы передумали?","conversation_message_id":29,"fwd_messages":[],"keyboard":{"one_time":true,"author_id":-183235386,"buttons":},"important":false,"random_id":0,"attachments":[],"is_hidden":false}}],"groups":[{"id":183235386,"name":"Бот пожертвований (пример)","screen_name":"donatebot","is_closed":0,"type":"page","is_admin":0,"is_member":0,"is_advertiser":0,"photo_50":"https:\/\/sun1-16.userapi.com\/c849324\/v849324326\/1b1da0\/6XC_EioXAW4.jpg?ava=1","photo_100":"https:\/\/sun1-14.userapi.com\/c849324\/v849324326\/1b1d9f\/dhXXJXl_S8U.jpg?ava=1","photo_200":"https:\/\/sun1-84.userapi.com\/c849324\/v849324326\/1b1d9e\/iGvySBJBBEo.jpg?ava=1"}]}}
Answer the question
In order to leave comments, you need to log in
This is already decoded json, you don't need to do it again, just refer to it, for example:
response.get('response').get('count')
# или
response['response']['count']
ways to find it for long strings, in which it is almost impossible to find it by the "gaze method"https://www.google.com/search?q=json+validator
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question