Skip to main content
PeterKa
Gold ⭐️
November 3, 2025
Solved

Jolt transformation based on unstable json format

Hi, I am looking how to handle cases when json format may vary between different client responses. On response

{
"data": [
{
"ID": "123",
"Name": "Queen"
},
{
"ID": "456",
"Name": "King"
}
]
}


we apply following jolt transform:

[
{
"operation": "shift",
"spec": {
"data": {
"*": {
"ID": {
"456": {
"@(2,Name)": "Name"
}
}
}
}
}
}
]

but some times response is coming without leading "{"data":
and our transformation fails. So, generally, how can we query json with JOLT if we know for instance that Name and ID are next to each other somewhere in the structure?

 

 

PeterKa
PeterKaAnswer
Gold ⭐️
November 20, 2025

Generally, I agree with the comments and JOLT is not so flexible for this purpose. In my case I did it with multiple matches for various responses, but still format is needed. I will close the ticket, thank you Andrés @vafs 

3 replies

vafs
Gold ⭐️⭐️⭐️
Gold ⭐️⭐️⭐️
November 4, 2025

Hello @PeterKa, 

Thanks for reaching our Community. 

For this, JOLT always need to have the values, it's not very much flexible if an expected value is missing. 

But, something that JOLT offers is the default operation, that may help you to add "{"data": if it is already included. 
You can see it here: https://lucabiscotti.github.io/jolt-guide.github.io/#default 

That option may help you to have the needed format always before the shift. 

Translate
Regards, Andrés Fallas -- Was your question answered? Please take some time to click on "Accept as Solution" below this post. If you find a reply useful, say thanks by clicking on the thumbs-up button.
DianaTorres
Community Manager
Community Manager
November 19, 2025

@PeterKa Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.  Thanks.

Translate
Regards, Diana Torres, Senior Community Moderator
PeterKa
PeterKaAuthorAnswer
Gold ⭐️
November 20, 2025

Generally, I agree with the comments and JOLT is not so flexible for this purpose. In my case I did it with multiple matches for various responses, but still format is needed. I will close the ticket, thank you Andrés @vafs 

Translate