I have some protocol file, but they don't have root type. So I can't use flatc to parse json. When I look up for the docs, I find a few methods.For example: flatbuffes::Parse flatbuffers::Registry
.I don't know how to use them correctly,because I'm not very proficient in C++.Can anyone give me an example or detailed documentation.
A protocol file
namespace serial.proto.api.login;
table LoginReq {
account:string;
passwd:string;
device:string;
token:string;
}
table LoginRsp {
account:string;
passwd:string;
device:string;
token:string;
}
table LogoutReq {
account:string;
}
table LogoutRsp {
account:string;
}
My code:
auto json_file = R"({"account":"test","passwd":"test01","device":"test","token":"asdfasdfasdf"})";
flatbuffers::Parser parser;
parser.Parse(json_file);
Thanks!!!