I have simple JSON and I want to reorganize the keys with JOLT transformation: Input JSON looks like this:
[
{
"Firstname": "John",
"LastName": "JohnLastName",
"City": "TestCity",
"PostCode": "25466",
"Street": "85.",
"HousNumber": "5",
"Phone": "0054565685",
"Email": "-"
}
]
and wished output should be:
{
"Firstname": "John",
"LastName": "JohnLastName",
"Address": {
"City": "TestCity",
"PostCode": "25466",
"Street": "85",
"HousNumber": "5"
},
"Contact": {
"Phone": "0054565685",
"Email": "-"
}
}
You can use the below Jolt Spec
[
{
"operation": "shift",
"spec": {
"*": {
"City": "Address.&",//Get the key and value where the key is City and place them within the Address map
"PostCode": "Address.&",
"Street": "Address.&",
"HousNumber": "Address.&",
"Phone": "Contact.&",
"Email": "Contact.&",
"*": "&"// Get the remaining fields of the input JSON
}
}
}
]