I have a requirement where re-arrangement of fields need to be done in a nested JSON which has array objects.
Below is the sample input:
{
"_id": "1234",
"Name": "John",
"City": "New Jersey",
"Order": [
{
"item": "pizza",
"qty": 2
},
{
"item": "coke",
"qty": 2
}
],
"State": "NJ",
"Phone": "67755321",
"Paymenttype": "Card"
}
My Jolt is able to populate all fields, but unable to figure out how to get the 'order data' in same manner in output
My code:
[
{
"operation": "shift",
"spec": {
"_id": "_id",
"Name": "Name",
"State": "State",
"Phone": "Phone"
}
}
]
Expected output:
{
"_id" : "1234",
"Name" : "John",
"State" : "NJ",
"Phone" : "67755321",
"Order": [
{
"item": "pizza",
"qty": 2
},
{
"item": "coke",
"qty": 2
}
],
"Paymenttype": "Card"
}
