问题
Lets say my json is:
{
"rating": {
"primary": {
"value": ["a","B",1]
}
}
}
What I want to achieve is:
{
"values": "a, B, 1"
}
I'm using jolt json to json code.
回答1:
It is not possible with stock transformations of Jolt. You need to write your custom transformation. Check the documentation section on how to write your own transformations.
回答2:
you can try the following spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"value": "=concat(@(2,rating.primary.value[0]),',',@(2,rating.primary.value[1]),',',@(2,rating.primary.value[2]))"
}
},
{
"operation": "remove",
"spec": {
"rating": ""
}
}
]
来源:https://stackoverflow.com/questions/35707768/json-to-json-changing-array-to-one-long-string-using-jolt