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

Adobe Document Generation API嵌套数组JSON调用报错排查

Adobe Document Generation API JSON结构报错问题

我用下面的JSON数据调用Adobe Document Generation API时出现报错,单独用第一个对象没问题,但用完整数组就报错,不确定JSON结构哪里有问题。

完整JSON数据:

[  
  {
    "OwnerID": "L001",
    "Properties": [
        [
            {
                "PropertyID": "P001",
                "Property Address": "12 St LA",
                "Rent": "300",
                "Bedroom ": "2 "
            }
        ],
        [
            {
                "PropertyID": "P002",
                "Property Address": "3 St SA",
                "Rent": "450",
                "Bedroom ": "3 "
            }
        ]
    ]
  },
  {
      "OwnerID": "L002",
      "Properties": [
        [
            {
                "PropertyID": "P003",
                "Property Address": "4 St SA",
                "Rent": "500",
                "Bedroom ": "4 "        
            }
        ]
    ]
  },
  {
      "OwnerID": "L003",
      "Properties": [
        [
            {
                "PropertyID": "P004",
                "Property Address": "20 St LA",
                "Rent": "400",
                "Bedroom ": "2 "
            }
        ]
    ]
  }
]

错误提示:
Adobe错误信息

仅使用该JSON中的第一个对象时无报错,数据如下:

{
    "OwnerID": "L001",
    "Properties": [
        [
            {
                "PropertyID": "P001",
                "Property Address": "12 St LA",
                "Rent": "300",
                "Bedroom ": "2 "
            }
        ],
        [
            {
                "PropertyID": "P002",
                "Property Address": "3 St SA",
                "Rent": "450",
                "Bedroom ": "3 "
            }
        ]
    ]
}

问题原因与解决方法

问题出在Properties字段的冗余嵌套上:你给的结构是数组套数组再套对象([[{}]]),Adobe Document Generation API处理多层嵌套数组时容易解析异常,尤其是当模板中需要遍历数组数据时,这种多余的嵌套会让API无法正确识别数据层级。

把Properties里的内层数组去掉,改成直接包含对象的一维数组即可,修正后的完整JSON如下:

[  
  {
    "OwnerID": "L001",
    "Properties": [
            {
                "PropertyID": "P001",
                "Property Address": "12 St LA",
                "Rent": "300",
                "Bedroom ": "2 "
            },
            {
                "PropertyID": "P002",
                "Property Address": "3 St SA",
                "Rent": "450",
                "Bedroom ": "3 "
            }
    ]
  },
  {
      "OwnerID": "L002",
      "Properties": [
            {
                "PropertyID": "P003",
                "Property Address": "4 St SA",
                "Rent": "500",
                "Bedroom ": "4 "        
            }
    ]
  },
  {
      "OwnerID": "L003",
      "Properties": [
            {
                "PropertyID": "P004",
                "Property Address": "20 St LA",
                "Rent": "400",
                "Bedroom ": "2 "
            }
    ]
  }
]

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.14 22:25:29