简体   繁体   English

如何创建多根 flatbuffer json 文件?

[英]How to create a multi root flatbuffer json file?

How to create a multi root flatbuffer json file?如何创建多根 flatbuffer json 文件?

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

table Attack {
    damage:short;
}

I created the following json file我创建了以下json文件

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

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

Add root_type Login to the bottom of your schema file.root_type Login添加到架构文件的底部。 If you also want to parse JSON from the command-line with Attack then stick that into its own schema, or use --root-type manually.如果您还想使用Attack从命令行解析 JSON,则将其粘贴到其自己的架构中,或手动使用--root-type

Also see the documentation, eg https://google.github.io/flatbuffers/flatbuffers_guide_using_schema_compiler.html另请参阅文档,例如https://google.github.io/flatbuffers/flatbuffers_guide_using_schema_compiler.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM