我正在尝试对这种json进行颠簸转换:
{
"id" : "6aa0734f-6d6a-4b95-8a2b-2dde346f9df7",
"ts" : 1583684304500000,
"measurements" : {
"A4" : {
"value" : 164341584
},
"A5" : {
"value" : -20486832
}
}}
最后我需要得到这样的东西:
{"id" : "6aa0734f-6d6a-4b95-8a2b-2dde346f9df7",
"ts" : 1583684304500000,
"A4" : 164341584,
"A5" : -20486832
}
我需要使用哪种规格?
非常感谢!
答案 0 :(得分:1)
震动规格:
[
{
"operation": "shift",
"spec": {
"ts": "ts",
"id": "id",
"measurements": {
"*": {
"*": {
"@": "&2"
}
}
}
}
}
]
输入:
{
"id": "6aa0734f-6d6a-4b95-8a2b-2dde346f9df7",
"ts": 1583684304500000,
"measurements": {
"A4": {
"value": 164341584
},
"A5": {
"value": -20486832
}
}
}
输出:
{
"ts" : 1583684304500000,
"id" : "6aa0734f-6d6a-4b95-8a2b-2dde346f9df7",
"A4" : 164341584,
"A5" : -20486832
}
适用于任意数量的A。在这里尝试:https://jolt-demo.appspot.com/#inception