I've the JSON source data file as like below and i'll need the Expected Results in a quite different format which is also shown below, is there a way i can achieve this using Spark Scala. Appreciate your help on this
JSON source data file
{
"APP": [
{
"E": 1566799999225,
"V": 44.0
},
{
"E": 1566800002758,
"V": 61.0
}
],
"ASP": [
{
"E": 1566800009446,
"V": 23.399999618530273
}
],
"TT": 0,
"TVD": [
{
"E": 1566799964040,
"V": 50876515
}
],
"VIN": "FU74HZ501740XXXXX"
}
Expected Results:
JSON Schema:
|-- APP: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- E: long (nullable = true)
| | |-- V: double (nullable = true)
|-- ASP: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- E: long (nullable = true)
| | |-- V: double (nullable = true)
|-- ATO: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- E: long (nullable = true)
| | |-- V: double (nullable = true)
|-- MSG_TYPE: string (nullable = true)
|-- RPM: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- E: long (nullable = true)
| | |-- V: double (nullable = true)
|-- TT: long (nullable = true)
|-- TVD: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- E: long (nullable = true)
| | |-- V: long (nullable = true)
|-- VIN: string (nullable = true)
