V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Apol1oBelvedere
V2EX  ›  问与答

Google Cloud Platform 的 BigQuery 上传 JSON-LD 格式数据始终解析报错,有无办法修复或线下验证工具?

  •  
  •   Apol1oBelvedere · Dec 26, 2025 · 1152 views
    This topic created in 125 days ago, the information mentioned may be changed or developed.

    Google Cloud Platform 的 BigQuery 上传 JSON-LD 格式数据始终解析报错,已经注意了如下语法要点:

    1. 每行一个对象:每个完整的 JSON 对象必须占据一行。在 Notepad++中显示行尾符号能看到[CR][LF]格式字符。
    2. 严禁外层中括号:整个文件不能包裹在 [...] 中。
    3. 严禁行尾逗号:每行末尾的对象后面不能有逗号 ,。
    4. 禁止跨行:一个 JSON 对象内部不能有换行符。所有的键值对必须挤在同一行内。
    5. 字符编码:必须是 不带 BOM 的 UTF-8 编码。也用 Emeditor 重新转过。

    也尝试编写 Python 脚本验证,能通过。但是导入 BigQuery 还是报错如下:

    未能创建表:Error while reading data, error message: Failed to parse JSON: Unknown token type; Unexpected token; Parser terminated before end of string File: a.json
    
    未能创建表:Error while reading data, error message: Failed to parse JSON: Parser terminated before end of string File: b.json
    

    请问有无办法修复或线下 JSON-LD 格式验证工具?

    Apol1oBelvedere
        1
    Apol1oBelvedere  
    OP
       Dec 28, 2025
    更新解决办法:
    有一些数据有问题,难以检查出来,使用 jaq 工具进行了清洗后解决问题。


    后续疑问:
    清洗导致删除了一些记录,有无办法或工具把问题记录提取出来单独进行修复后补充上传?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2452 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 05:15 · PVG 13:15 · LAX 22:15 · JFK 01:15
    ♥ Do have faith in what you're doing.