I am trying to write a specification using Jolt, I have been struggling with it a little, my desired output is:
{
"Team": [
{
"ID": "1",
"Source": {
"HV": 1,
"ID": 1
}
},
{
"ID": "3",
"Source": {
"HV": 2,
"ID": 3
}
}
]
}
I have the following input:
[
{
"Page": 910407,
"TimingID": 10014,
"ScoreInfo": {
"Inn": 9,
"TB": 1,
"Team": [
{
"HV": 1,
"ID": 1,
"Score": 4
},
{
"HV": 2,
"ID": 3,
"Score": 2
}
],
"HV": null
}
}
]
But after execute this specification:
[
{
"operation": "shift",
"spec": {
"0": {
"ScoreInfo": {
"Team": {
"*": "&"
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": "Team.@ID.Source"
}
}
]
I ended up with this result:
{
"Team" : {
"1" : {
"Source" : {
"HV" : 1,
"ID" : 1,
"Score" : 4
}
},
"3" : {
"Source" : {
"HV" : 2,
"ID" : 3,
"Score" : 2
}
}
}
}
I would some help to figure out how to solve, I have being reading and practing but still having some doubts in cases, where it needs a little bit more miles using Jolt when the output starting get a little bit more advanced.
Thanks,