在 JOLT 中验证和转换数组对象
Validating and transform the array objects in JOLT
想要输出 JSON 基于输入中的活动状态 array.If 活动为真提供值对象。
输入:
{
"services": [
{
"active": true,
"value": "Clampable",
"key": "40300"
},
{
"active": false,
"value": "Mixed load",
"key": "40302"
}
]
}
规格:
[
{
"operation": "shift",
"spec": {
"services": {
"*": {
"key": {
"40302": {
"#mixed": "loading_method"
},
"40300": {
"#clampable": "loading_method"
}
}
}
}
}
}
]
输出:
"loading_method" : [ "clampable", "mixed"]
我不希望输出混合值,因为状态为 false。
任何建议都会很棒..
这有效,
如果 active 为真,则移动值节点。
[
{
"operation": "shift",
"spec": {
"services": {
"*": {
"active": {
"true": {
"@(2,value)": "loading_method"
}
}
}
}
}
}
]
想要输出 JSON 基于输入中的活动状态 array.If 活动为真提供值对象。 输入:
{
"services": [
{
"active": true,
"value": "Clampable",
"key": "40300"
},
{
"active": false,
"value": "Mixed load",
"key": "40302"
}
]
}
规格:
[
{
"operation": "shift",
"spec": {
"services": {
"*": {
"key": {
"40302": {
"#mixed": "loading_method"
},
"40300": {
"#clampable": "loading_method"
}
}
}
}
}
}
]
输出:
"loading_method" : [ "clampable", "mixed"]
我不希望输出混合值,因为状态为 false。 任何建议都会很棒..
这有效,
如果 active 为真,则移动值节点。
[
{
"operation": "shift",
"spec": {
"services": {
"*": {
"active": {
"true": {
"@(2,value)": "loading_method"
}
}
}
}
}
}
]