我正在尝试为摇晃变换制作 json 但我卡在嵌套数组格式中

I am trying to make a json for the jolt transform but I am stuck in nested array format

我正在尝试对颠簸进行转换,但我在嵌套数组中遇到问题。我没有得到描述值。 我放了一些代码 JSON 输入是

{
  "id": 3,     
  "name": "Sample Product",
  "attribute_set_id": 4,
  "price" : 10,
 "custom_attributes": [
    {
      "attribute_code": "image",
      "value": "/1/_/1.jpg"
    },        
    {
      "attribute_code": "description",
      "value": "<p>This is Sample Product for test</p>"
    }        
  ]  
}

我的 Jolt 规格是

[
  {
    "operation": "shift",
    "spec": {
      "id": "id",         
      "name": "name",
      "description": "custom_attributes[0].attribute_code.value"
    }
]

我的预期输出是

{
  "id" : 3,
  "name" : "Sample Product",
 "description" : "<p>This is Sample Product for test</p>",
 "image" : "/1/_/1.jpg",
 "start_price" : 10,
 "current_price" : 10
}

如果 "attribute_code": "image""attribute_code": "description" 总是出现在数组的第一个和第二个元素中,您可以使用以下 Jolt 规范简单地转换给定的 JSON 字符串:

[
  {
    "operation": "shift",
    "spec": {
      "id": "id",
      "name": "name",
      "custom_attributes": {
        "1": {
          "value": "description"
        },
        "0": {
          "value": "image"
        }
      },
      "price": ["start_price", "current_price"]
    }
  }
]