I have a below input JSON and need to convert it to output JSON via jolt.
Input :
{
"A": "value1",
"B": "value2",
"C": {
"D": "x1",
"E": "x2"
}
}
Output :
{
"A": "value1",
"B": "value2",
"E": "x2",
"C": {
"D": "x1"
}
}
Can anyone help me with the jolt specs?
Take E
from the sub document and put it into the root document.
Jolt spec:
[
{
"operation": "shift",
"spec": {
"*": {
"*": "[&1].&",
"C": {
"E": "[&2].&",
"*": "[&2].C.&"
}
}
}
}
]
Input:
[
{
"A": "value1",
"B": "value2",
"C": {
"D": "x1",
"E": "x2",
"F": {
"a": "x1",
"x": {
"y": 1
}
},
"H": "x4"
}
}
]
Output:
[
{
"A": "value1",
"B": "value2",
"C": {
"D": "x1",
"F": {
"a": "x1",
"x": {
"y": 1
}
},
"H": "x4"
},
"E": "x2"
}
]