I am trying to write a Jolt Spec on nested json of following input record. There is a challenge in this...objectname is not always have multiple object like below, in some case it contain single object, and we have to parse this too.
Input
{
"Status": "Green",
"objectname": {
"LED TV": {
"values": [
[
"one",
"two",
"three",
"four"
],
[
0,
0,
0,
"one"
],
[
0,
"one",
0,
"two"
]
],
"time": [
1663331241000,
1663330155000,
1663328545000
]
},
"LED Bulb": {
"values": [
[
"one",
"two",
"three",
"four"
],
[
0,
0,
0,
"one"
],
[
0,
"one",
0,
"two"
]
],
"time": [
1663331241000,
1663330155000,
1663328545000
]
},
"LED LAMP": {
"values": [
[
"one",
"two",
"three",
"four"
],
[
0,
0,
0,
"one"
],
[
0,
"one",
0,
"two"
]
],
"time": [
1663331541000,
1663330555000,
1663328545000
]
}
},
"Source": "LED EQUIPS"
}
Expected Output
[
[
"Status",
"Green",
"objectname",
"LED TV",
"values",
[
"one",
"two",
"three",
"four"
],
[
0,
0,
0,
"one"
],
[
0,
"one",
0,
"two"
]
],
[
"Status",
"Green",
"objectname",
"LED Bulb",
"values",
[
"one",
"two",
"three",
"four"
],
[
0,
0,
0,
"one"
],
[
0,
"one",
0,
"two"
]
],
[
"Status",
"Green",
"objectname",
"LED LAMP",
"values",
[
"one",
"two",
"three",
"four"
],
[
0,
0,
0,
"one"
],
[
0,
"one",
0,
"two"
]
],
"Source",
"LED EQUIPS"
]
PS : we have to parse "objectname" if they have one or multiple entries in it.