Created 02-18-2022 07:31 AM
Hi everyone!
I hope all is well.
I have this json
and I transformed the structure to this:
Which is perfect except for the inner arrays, I want to flatten the array to be like this
Here is my spec:
Created 02-18-2022 11:07 PM
Great job getting thus far with the Jolt spec, @Ibrahem !
Here's the remaining bit:
[
{
"operation": "shift",
"spec": {
"Data": {
"ARRAY_ONE": {
"*": {
"@(2,ID)": "[#2].ID",
"@(2,DATE)": "[#2].DATE",
"NAME": "[#2].NAME",
"details": {
"*": {
"address": "[#4].detail_&1_address"
}
}
}
}
}
}
}
]
Cheers,
André
Created 02-22-2022 03:42 PM
Yes, it is possible:
[
{
"operation": "shift",
"spec": {
"Data": {
"ARRAY_ONE": {
"*": {
"@(2,ID)": "[#2].ID",
"@(2,DATE)": "[#2].DATE",
"NAME": "[#2].NAME",
"details": {
"*": {
"address": "[#4].detail_&1_address"
}
},
"@(0,details)": "[#2].details"
}
}
}
}
}
]
Created 02-18-2022 11:07 PM
Great job getting thus far with the Jolt spec, @Ibrahem !
Here's the remaining bit:
[
{
"operation": "shift",
"spec": {
"Data": {
"ARRAY_ONE": {
"*": {
"@(2,ID)": "[#2].ID",
"@(2,DATE)": "[#2].DATE",
"NAME": "[#2].NAME",
"details": {
"*": {
"address": "[#4].detail_&1_address"
}
}
}
}
}
}
}
]
Cheers,
André
Created on 02-22-2022 03:44 AM - edited 02-22-2022 03:46 AM
Thank you so much @araujo for the help.
Is it possible to have the new flatten array and the original array within one jolt spec?
This is the current structure
Created 02-22-2022 03:42 PM
Yes, it is possible:
[
{
"operation": "shift",
"spec": {
"Data": {
"ARRAY_ONE": {
"*": {
"@(2,ID)": "[#2].ID",
"@(2,DATE)": "[#2].DATE",
"NAME": "[#2].NAME",
"details": {
"*": {
"address": "[#4].detail_&1_address"
}
},
"@(0,details)": "[#2].details"
}
}
}
}
}
]
Created 02-22-2022 11:48 PM
THANK YOU SO MUCH.
It makes total sense.