You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

请求Jolt转换帮助:将Map数组转换为数组的数组

Jolt转换:将Map数组转为数组的数组

输入:

{
  "items": [{
    "a": 1,
    "b": 1
  }, {
    "a": 2,
    "b": 2
  }]
}

期望输出:

{
  "items": [
    [1, 1],
    [2, 2]
  ]
}

Jolt转换规则:

[
  {
    "operation": "shift",
    "spec": {
      "items": {
        "*": {
          "a": "items[&1][0]",
          "b": "items[&1][1]"
        }
      }
    }
  }
]

规则说明:

  • 用shift操作重排数据结构
  • items.*遍历输入里items数组的每一个元素,*指代数组的索引
  • a": "items[&1][0]"把当前元素的a值,放到输出items数组对应索引(&1引用外层的数组索引)的子数组第0位
  • b": "items[&1][1]"同理,将b值放到对应子数组的第1位

内容的提问来源于stack exchange,提问作者Datadev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 10:25:00