i have tricky json which i would like to load into a dataframe and need assistance on how i may be able to define a schema
{
"1-john": {
"children": ["jack", "jane", "jim"]
},
"2-chris": {
"children": ["bill", "will"]
}
}
dataframe output needed
ID | father | children |
---|---|---|
1 | john | ["jack", "jane", "jim"] |
2 | chris | ["bill", "will"] |
In the case of pandas, Use:
You can then convert this to pyspark df: