【问题标题】:How to create a multi root flatbuffer json file?如何创建多根 flatbuffer json 文件?
【发布时间】:2021-10-17 09:43:24
【问题描述】:

如何创建多根flatbuffer json文件?

table Login {
    name:string;
    password:string;
}

table Attack {
    damage:short;
}

我创建了以下 json 文件

{
    "Login": {
        "name": "a",
        "password": "a",
    }
}

但得到错误:no root type set to parse json with

【问题讨论】:

    标签: c++ flatbuffers


    【解决方案1】:

    root_type Login 添加到架构文件的底部。如果您还想使用 Attack 从命令行解析 JSON,请将其粘贴到自己的架构中,或手动使用 --root-type

    另请参阅文档,例如https://google.github.io/flatbuffers/flatbuffers_guide_using_schema_compiler.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-11
      • 1970-01-01
      • 1970-01-01
      • 2022-11-30
      • 1970-01-01
      • 2016-01-06
      相关资源
      最近更新 更多