我有一个用例,我需要将所有JSON对象放在嵌套的JSON数组中。我试着使用@来得到这个,但总是得到null。贴上了我正在使用的震动
输入:
{
"status": "Pink",
"summary": "violate",
"type": "Image",
"affectedPic": [
{
"PicType": "Nature",
"name": "County-nature",
"PicId": 4239
},
{
"PicType": "Abstract",
"name": "Buildings",
"PicId": 1937
},
{
"PicType": "Technology",
"name": "AI",
"PicId": 6937
}
],
"archived": true
}
预期输出:
{
"affectedPic": [
{
"PicType": "Nature",
"name": "County-nature",
"PicId": 4239,
"status": "Pink",
"summary": "violate",
"type": "Image",
"archived": true
},
{
"PicType": "Abstract",
"name": "Buildings",
"PicId": 1937,
"status": "Pink",
"summary": "violate",
"type": "Image",
"archived": true
},
{
"PicType": "Technology",
"name": "AI",
"PicId": 6937,
"status": "Pink",
"summary": "violate",
"type": "Image",
"archived": true
}
]
}
My Jolt:
[
{
"operation": "shift",
"spec": {
"status": "@(1,affectedPic)",
"summary": "@(1,affectedPic)",
"type": "@(1,affectedPic)",
"archived": "@(1,affectedPic)"
}
}
]
我已经在JOLT规范中应用了多种组合,但它不起作用,请建议。
1条答案
按热度按时间kuarbcqp1#
你可以用
http://jolt-demo.appspot.com/网站上的demo是:
或者更动态地(不单独写入留在数组外部的属性):
http://jolt-demo.appspot.com/网站上的demo是: