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

如何用JSONata将指定JSON结构转换为拼接值列表?

JSONata 查询解决方案

正确的JSONata查询语句

object.name & " " & list.result

或者用显式遍历数组的写法(效果一致):

list.(object.name & " " & result)

逻辑说明

  • object.name 提取前缀字符串 "ResultVALUE:"
  • list.result 提取数组中所有result字段的值,得到数组 ["Result A", "Result B", "Result C"]
  • JSONata的字符串连接操作会自动将前缀与数组中的每个元素逐一拼接,最终生成目标格式的字符串数组

验证效果

输入JSON:

{
  "object":{
    "name": "ResultVALUE:"
  },
  "list": [
    { "result": "Result A" },
    { "result": "Result B" },
    { "result": "Result C" }
  ]
}

执行查询后输出:

[
  "ResultVALUE: Result A",
  "ResultVALUE: Result B",
  "ResultVALUE: Result C"
]

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.05 06:07:02