Q:

How to get exact data from json using python

I'm getting an error trying to parse json file
{
0:
    {
        'data':
            [
                {
                    'state': 1,
                    'invitation_sent_at': None,
                    'group_id': None,
                    'firstname': 'goog',
                    'company': 'wbru',
                    'member_of': None,
                    'updated_at': '2017-07-21T08:07:45.375Z',
                    'last_login': None,
                    'manager_ad_id': None,
                    'distinguished_name': None,
                    'comment': '',
                    'username': 'predicted',
                    'title': '',
                    'lastname': 'hello',
                    'samaccountname': None,
                    'status': 1,
                    'locked_until': None,
                    'locale_code': None,
                    'role_id': None,
                    'userprincipalname': None,
                    'phone': '777',
                    'openid_name': 'gege',
                    'directory_id': None,
                    'id': 34486990,
                    'department': '',
                    'activated_at': None,
                    'external_id': None,
                    'created_at': '2017-07-21T08:07:45.347Z',
                    'email': 'gege@mail.ru',
                    'password_changed_at': None,
                    'invalid_login_attempts': None
                },
            ], 
        'pagination':
            {
                'before_cursor': None,
                'previous_link': None,
                'after_cursor': None,
                'next_link': None
            },
       'status':
            {
                'type': 'success',
                'message': 'Success',
                'code': 200,
                'error': False
            }
    }
}

So I need to get id. I used
dumps = json.dumps(allUsers)
print(dumps)

This will print out json file. 
But when I'm trying to get data or id, it shows this error
print(dumps['data'])

Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: string indices must be integers

Please, help me to get id.

A:

print(json.loads(dumps)[“data”][0]['id')

json.loads() accepts a json string.  It then converts it into a python dict or a python list depending on your json.  In this case it converts it into a dict. 
Once you have a dict, you can access the attributes with the ["data"]. 
If you run into the TypeError: string indices must be integers error, that means that json.loads(dumps) is likely returning a list of dicts, and not a dict.  So you may need to do the following. 
print(json.loads(dumps)[0]["data"][0]["id"]

The [0] will select the first object in the list and then you can access its data attribute. 
Hope that makes sense!