I am looking at the prefix soup example from jolt-demo.appspot, which seems to be almost exactly what I need however I made a minor modification on the input to have multiple objects in an array, then I changed the spec to have * wildcard to account for the array and the result is not exactly how I need it. I'm obviously missing something fundamental but I don't know what. Any help would be greatly appreciated.
Input JSON
[
{
"rating-primary": 1,
"rating-Price": 2,
"rating-Design": 4,
"rating-RatingDimension3": 1
},
{
"rating-primary": 7,
"rating-Price": 8,
"rating-Design": 9,
"rating-RatingDimension3": 10
}
]
Spec
[
{
"operation": "shift",
"spec": {
"*": {
"rating-primary": "Rating",
"rating-*": "SecondaryRatings.&(0,1)"
}
}
}
]
Expected Output
[
{
"Rating": 1,
"SecondaryRatings": {
"Primary": 1,
"Price": 2,
"Design": 4,
"RatingDimension3": 1
}
},
{
"Rating": 7,
"SecondaryRatings": {
"Primary": 1,
"Price": 2,
"Design": 4,
"RatingDimension3": 1
}
}
]
Actual Output
{
"Rating" : [ 1, 7 ],
"SecondaryRatings" : {
"Price" : [ 2, 8 ],
"Design" : [ 4, 9 ],
"RatingDimension3" : [ 1, 10 ]
}
}
question from:
https://stackoverflow.com/questions/65911271/jolt-prefix-soup-example-with-an-array-of-objects-as-input 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…