I have a JSON response that I am converting to a DataFrame in Python.
JSON response:
[
{
"id": 123456,
"first_name": "John",
"last_name": "Doe",
"fields": [
{
"title": "ABC",
"value": "123"
},
{
"title": "DEF",
"value": "456"
}
]
}
]
When I parse this JSON to a DataFrame, the columns appear as id, first_name
, last_name
and fields
. Where the fields
column contains the two nested JSON objects:
[{"title": "ABC","value": "123"},{"title": "DEF","value": "456"}]
How would I go about splitting the two objects in fields
as their own columns?
For context, I am trying to print the results of the DataFrame to a csv file, where each object in fields
has its own column.