jamescourtney / FlatSharp

Fast, idiomatic C# implementation of Flatbuffers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Json serialization support?

cove opened this issue · comments

commented

Hi!

Any thoughts on supporting serialization to json as well or any suggestions on where to start? e.g. flatc's --cs-gen-json-serializer option.

The use case I have is that my game uses gRPC+flatc, but I have low code admin tools that only understand REST/json and need to use the API too.

This is something I've considered doing. However, the thing I always come back to is that there are already a ton of great JSON libraries available for .NET (unsure about Unity -- perhaps you can educate me!), and I'm not sure what I could do better than them.

Serializing to JSON should be pretty straightforward. Just a see-thing-write-thing approach. Parsing from JSON would be considerably more difficult because of the additional grammar.

commented

Oh I don't actually need to go from JSON to back to FlatBuffers encoding actually. I just need to have the same interface to the objects so that I don't need to duplicate the schema, maintaining one for json and another for FlatBuffers. What do think?

commented

I think what I want actually is Microsoft.AspNetCore.Grpc.HttpApi, but with FlatBuffers support. (I'm not a C#/.Net expert (coming more from UE/C++) so don't know my way around the frameworks that well.)

commented

Closing this out since it's probably better handled in grpc/grpc-dotnet#167 and grpc/grpc-dotnet#1687