Json 我怎样才能使用;“不相等”;使用JOLT规范过滤阵列时的条件

Json 我怎样才能使用;“不相等”;使用JOLT规范过滤阵列时的条件,json,jolt,Json,Jolt,我想使用JOLT转换过滤JSON数组,条件为负。在下面的示例中,我只想要URL值不等于不可用的记录。 { “照片”:[ { “Id”:“327703”, “标题”:“测试>>照片1”, “Url:”不可用。“ }, { “Id”:“327704”, “标题”:“测试>>照片2”, “Url”:”http://bob.com/0001/327704/photo.jpg" }, { “Id”:“327705”, “标题”:“测试>>照片3”, “Url”:”http://bob.com/0001/

我想使用
JOLT
转换过滤
JSON
数组,条件为负。在下面的示例中,我只想要
URL
值不等于
不可用的记录。

{
“照片”:[
{
“Id”:“327703”,
“标题”:“测试>>照片1”,
“Url:”不可用。“
},
{
“Id”:“327704”,
“标题”:“测试>>照片2”,
“Url”:”http://bob.com/0001/327704/photo.jpg"
},
{
“Id”:“327705”,
“标题”:“测试>>照片3”,
“Url”:”http://bob.com/0001/327705/photo.jpg"
}
]

}
看看非常类似的问题。基于此,您可以按以下方式解决此问题:

[
  {
    "operation": "shift",
    "spec": {
      "Photos": {
        // loop thru all the photos
        "*": {
          // for each URL
          "Url": {
            // For "Not Available." do nothing.
            "Not Available.": null,
            // In other case pass thru
            "*": {
              "@2": "Photos[]"
            }
          }
        }
      }
    }
    }
]

通常,当您想要否定过滤器时,您会执行一个过滤器,并在转换过程中通过跳过项的
null

看看非常类似的问题。基于此,您可以按以下方式解决此问题:

[
  {
    "operation": "shift",
    "spec": {
      "Photos": {
        // loop thru all the photos
        "*": {
          // for each URL
          "Url": {
            // For "Not Available." do nothing.
            "Not Available.": null,
            // In other case pass thru
            "*": {
              "@2": "Photos[]"
            }
          }
        }
      }
    }
    }
]
通常,当您要对筛选器求反时,您会执行一个筛选器,并在转换过程中传递
null
,该项将跳过