如何创建多根 flatbuffer json 文件?

How to create a multi root flatbuffer json file?

如何创建多根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

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

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