Skip to content

JSON serializer

Andreas Wenger edited this page Sep 3, 2020 · 1 revision

Of course this library contains a JSON (de)serializer, based on Newtonsoft.JSON, that works out of the box.

However, your main project may use a different serializer or different settings, e.g. camelCase vs. PascalCase formatting, support features like polymorphism and so on. For this, we provide the IJsonLib interface.

When initializing the client or server, provide your own IJsonLib implementation in the JsonLib property of the RpcSettings. The interface contains only two methods, one for serializing a class to JSON and one for deserializing JSON to a class instance of a given type. It is intentionally kept very simple, so that it is easy to adapt it to any JSON library used in the main project.