Jolt 将 json 数组转换为单个元素

Jolt to convert json array into single element

下面显示的是 JSON 文档中的 2 条记录(我会有 2 条以上):

[{
    "abc": [{
        "value": 44.636914,
        "testName": "1 Month",
        "date": "2020-02-14"
    },
    {
        "value": -0.117243,
        "testName": "1 Week",
        "date": "2020-01-21"    
    }],
    "currency": "CAD",
    "date2": "2020-01-14",
    "id": "W38450"
}
{
    "abc": [{
        "value": -0.873175,
        "testName": "1 Month",
        "date": "2020-02-14"
    },
    {
        "value": 0.005599,
        "testName": "1 Week",
        "date": "2020-01-21"    
    },
    {
        "value": 0.001231,
        "testName": "11 Week",
        "date": "2020-02-21"    
    }],
    "currency": "CAD",
    "date2": "2020-01-14",
    "id": "W38209"
}]

我想使用 jolt 将 "abc" 中的数组转换为单个值

期望的输出:

[{
    "abc": "[{'value': 44.636914,'testName': '1 Month','date': '2020-02-14'},{'value': -0.117243,'testName': '1 Week','date': '2020-01-21'}]",
    "currency": "CAD",
    "date2": "2020-01-14",
    "id": "W38450"
}
{
    "abc": "[{'value': -0.873175,'testName': '1 Month','date': '2020-02-14'},{'value': 0.005599,'testName': '1 Week','date': '2020-01-21'},{'value': 0.001231,'testName': '11 Week','date': '2020-02-21'}]",
    "currency": "CAD",
    "date2": "2020-01-14",
    "id": "W38209"
}]

请注意,"abc" 的数组大小不是恒定的,我认为也有必要将双引号 (") 更改为单引号 (')。 请建议使用 Jolt 的解决方案。

这是结构样本。现在剩下要做的就是结合concat功能。

[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "abc": {
          "*": {
            "*": {
              "$": "[&4].toConcat[&2]",
              "@": "[&4].toConcat[&2]"
            }
          }
        },
        "currency": "[&1].currency",
        "date2": "[&1].date2",
        "id": "[&1].id"
      }
    }
  },
  {
    "operation": "modify-default-beta",
    "spec": {
      "*": {
        "abc": "=join(',',@(1,toConcat))"
      }
    }
  }
]