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

向IBM Watson Discovery上传JSON报错:不支持顶级数组格式求助

Fixing the "Top-level array JSON documents are not supported" Error in IBM Watson Discovery

Hey there, let's tackle that 400 error you're hitting when uploading your table data to Watson Discovery. The core issue here is straightforward: Watson Discovery doesn't accept JSON files that start with a top-level array ([ ... ]). It requires your data to be wrapped in a top-level object ({ ... }) instead.

Below are the supported formats you can use to structure your table-like data correctly:

1. Wrap Your Row Array in a Top-Level Object (Simplest Fix)

Take your existing array of row objects and nest it under a descriptive key (like rows, table_data, etc.). This preserves your original row structure while meeting Discovery's requirements. Example:

{
  "table_data": [
    {
      "employee_id": 101,
      "name": "Priya Mehta",
      "role": "Data Analyst",
      "location": "Bangalore"
    },
    {
      "employee_id": 102,
      "name": "Raj Patel",
      "role": "Software Engineer",
      "location": "Mumbai"
    }
  ]
}

2. Schema-Aware Structure (For Better Indexing & Querying)

If you want Discovery to recognize your table's structure more explicitly (helpful for later filtering/querying), you can separate column definitions from row data:

{
  "table_schema": {
    "columns": ["employee_id", "name", "role", "location"],
    "column_types": ["integer", "string", "string", "string"]
  },
  "table_rows": [
    [101, "Priya Mehta", "Data Analyst", "Bangalore"],
    [102, "Raj Patel", "Software Engineer", "Mumbai"]
  ]
}

Quick Rules to Follow

  • No top-level arrays: Always start your JSON with { and wrap all data inside this object.
  • Consistent keys: If using row objects, ensure every row has the same set of keys (columns) to avoid indexing inconsistencies.
  • Validate syntax: Double-check your JSON with a linter before uploading—invalid syntax will also trigger errors.

Once you adjust your JSON to fit one of these formats, the 400 error should disappear, and Discovery will process your table data smoothly.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 07:16:29