如何在Jolt的arraylist中获取具有特定属性的对象

我想用json数组进行Jolt转换,而我只想要具有特定属性的对象。 例如:

输入: { "characteristic": [ { "name": "BrandId","value": "b" },{ "name": "status","value": "SENT" },{ "name": "statusTxt","value": "sent" } ] }

我希望输出为

{
"status":"SENT","statusTxt":"sent"

}

smazhe 回答:如何在Jolt的arraylist中获取具有特定属性的对象

这将根据您的输入生成您想要的输出:

[
  {
    "operation": "shift","spec": {
      "characteristic": {
        "*": {
          "name": {
            "status": {
              "@(2,value)": "status"
            },"statusTxt": {
              "@(2,value)": "statusTxt"
            }
          }
        }
      }
    }
  }
]
本文链接:https://www.f2er.com/2690590.html

大家都在问