I have a python script which can take a JSON file and pulls out specific columns I want with the Pandas json_normalize function. But I have a nested JSON set of values within the JSON that I am trying to pull out but cant get the code to properly get those values.
Below is the JSON value. The top tier is "cardEditions" within that tier is "cardDetails". I want to grab some of the displayName and value details from this nested json and put them into the csv with the cardEditions and the editionNo value.
Looking for the output to be in a CSV pipe delimited like the following with the displayValues as the headers from the nested json.
| editionNo | Name | Edition | Position |
|---|---|---|---|
| 666 | Matt Hu | 1st Edition | Center Field |
{
"cardEditions": [{
"editionNo": 666,
"id": 1111,
"cardDetails": [{
"valueType": "Text",
"displayValueType": "Text",
"displayName": "Name",
"value": "Matt Hu"
},
{
"valueType": "Text",
"displayValueType": "Text",
"displayName": "Edition",
"value": "1st Edition"
},
{
"valueType": "Text",
"displayValueType": "Text",
"displayName": "Position",
"value": "Center Field"
}
],
"cardStatus": "NA"
}]
}