I have below input:
[
{
"seq_no": 18,
"Id": 174052,
"Date": "2021-12-26T00:00:00Z"
},
{
"seq_no": 19,
"Id": 174052,
"Date": "2021-12-26T00:00:00Z"
}
]
Jolt Spec:
[
{
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"seq_no": "=toString",
"Date": "=substring(@(1,REVISION_IND),0,10)"
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"seq_no": "[&1].seq_no",
"Id": "[&1].Id",
"Date": "[&1].Date"
}
}
},
{
"operation": "shift",
"spec": {
"*": "data"
}
},
{
"operation": "default",
"spec": {
"header": {
"submit": "true",
"comments": "3"
}
}
}
]
Output:
{
"data" : [ {
"seq_no" : "18",
"Id" : 174052,
"Date" : "2021-12-26T00:00:00Z"
}, {
"seq_no" : "19",
"Id" : 174052,
"Date" : "2021-12-26T00:00:00Z"
} ],
"header" : {
"submit" : "true",
"comments" : "3"
}
}
Desired Output:
{
"header" : {
"submit" : "true",
"comments" : "3"
},
"data" : [ {
"seq_no" : "18",
"Id" : 174052,
"Date" : "2021-12-26T00:00:00Z"
}, {
"seq_no" : "19",
"Id" : 174052,
"Date" : "2021-12-26T00:00:00Z"
} ]
}
Can you please help how I will get the header part and then the data. I used sort but it's not helping me. Appreciate your help. Thank you.