coordinate
coordinate

Reputation: 109

How to create a multi root flatbuffer json file?

How to create a multi root flatbuffer json file?

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

table Attack {
    damage:short;
}

I created the following json file

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

but get error: no root type set to parse json with

Upvotes: 0

Views: 363

Answers (1)

Aardappel
Aardappel

Reputation: 6074

Add root_type Login to the bottom of your schema file. 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.

Also see the documentation, e.g. https://google.github.io/flatbuffers/flatbuffers_guide_using_schema_compiler.html

Upvotes: 1

Related Questions