I have a requirement in which I need to merge two JSON arrays into one. Currently the JSON is like this:
[
{
"test": [
{
"count": 5,
"name": "highway"
}
]
},
{
"test": [
{
"count": 6,
"name": "plateau"
}
]
}
]
Now I need to merge the entire json array as a single array.
Like:
{
"test": [
{
"count": 5,
"name": "highway"
},
{
"count": 6,
"name": "plateau"
}
]
}
I am new to Jolt and hence don’t know what to try
2
Answers
If you use Jackson and Lombok, you can deserialize the data and then reduce it.
You should be able to do something similar to Jackson with Jolt. The underlying reduce is the main business logic here.
Output:
You can use the following shift transformation spec
the demo on the site http://jolt-demo.appspot.com/ is :