Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Jolt Specification, Apache Nifi

avatar
New Contributor
I have the following input format
INPUT.JSON
 

 

[
    {
        "name": "adam",
        "age": 12,
        "address": {
            "city": "delhi",
            "country": "india",
            "zip": "110011"
        }
    },
    {
        "name": "louis",
        "age": 23,
        "address": {
            "city": "goa",
            "country": "india",
            "zip": "110022"
        }
    }
]

 

 

After applying jolt transformation i want to get the following output

DESIRED OUTPUT.JSON

 

 

[
    {
        "name": "adam",
        "age": 12,
        "address": {
            "current_city": "delhi",            //change here
            "current_country": "india",         //change here
            "zipode": "110011"                  //change here
        }
    },

    {
        "name": "louis",
        "age": 23,
        "address": {
            "current_city": "goa",              //change here
            "current_country": "india",         //change here
            "zipode": "110022"                  //change here
        }
    }
]

 

 

 

Can you please help me with the jolt spec. thanks.

1 ACCEPTED SOLUTION

avatar
Expert Contributor

@shivam-optimus 

[
{
"operation": "shift",
"spec": {
"*": {
"address": {
"city": "[&2].address.current_city",
"country": "[&2].address.current_country",
"zip": "[&2].address.zipcode"
},
"*": "[&1].&"
}
}
}
]

 

View solution in original post

1 REPLY 1

avatar
Expert Contributor

@shivam-optimus 

[
{
"operation": "shift",
"spec": {
"*": {
"address": {
"city": "[&2].address.current_city",
"country": "[&2].address.current_country",
"zip": "[&2].address.zipcode"
},
"*": "[&1].&"
}
}
}
]