V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Apol1oBelvedere
V2EX  ›  问与答

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

  •  
  •   Apol1oBelvedere · 6 天前 · 620 次点击

    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
       4 天前
    更新解决办法:
    有一些数据有问题,难以检查出来,使用 jaq 工具进行了清洗后解决问题。


    后续疑问:
    清洗导致删除了一些记录,有无办法或工具把问题记录提取出来单独进行修复后补充上传?
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2327 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 05:15 · PVG 13:15 · LAX 21:15 · JFK 00:15
    ♥ Do have faith in what you're doing.