Need to know syntax to get the value of column name and value from JSON response in python

Viewed 23
{ "PrcCfgDetails": [
        {
            "header_id": "10984299",
            "line_id": "1143673632"
        },
        {
            "header_id": "10984299",
            "line_id": "1143673633"
       }
    ]
}

I have above response file and I have written next 2 line of code in python. I do see above in response2 but don't know how to write a loop and get the value of header_id and line_id for number of records in response. Can you please help me in writing rest of the code.

response2 = requests.post(OAUTH_ENDPOINT, headers=headers_get, data=python2json)
user_data1 = json.dumps(response2.text)
1 Answers

user_data1 = response2.json()

Will return a dictionary of lists of dictionary. The top level will have one key -- PrcCfgDetails -- accessible with user_data1.get('ProCfgDetails')

Related