Friday, September 15, 2017

Introducing Jsonics

Introducing Jsonics

Over the past months I have been working on a new opensource Json library for .net called Jsonics.
I am now pleased to announce its first release 0.1.0-alpha.

What is Jsonics?

Jsonics is a high performance Json Library for c#. Jsonics stands for JSON In C Sharp. Jsonics aims to be as fast as is possible in scenarios where the same type will be serialised or deserialised many times. Jsonics uses runtime code generation and other advanced techniques to create an optimal serialiser and deserialiser based on the supplied type.

How do I use it?

//create an optimised Json converter for type Person
var jsonConverter = JsonicFactory.Compile();

//serilize a person instance 
string jsonstring = jsonCoverter.ToJson(new Person(){"FirstName"="Luke", "LastName"="Skywalker"});

//deserialise a person json string
Person person = jsonCoverter.FromJson(jsonString);

How fast is it?

Nearlly all Json parsers claim to be the fast. Here are some claims by popular .net Json libraries.

Newtonsoft (

  • high-performance JSON framework for .NET
  • 50% faster than DataContractJsonSerializer, and 250% faster than JavaScriptSerializer.
  • Faster than Any Binary?
  • Jil aims to be the fastest general purpose JSON (de)serializer for .NET.

I don't want to make any claims about speed. These tend to either be proven wrong or to fail to age well. However Jsonics does have a focus on speed and currently performs well in relation to other .net Json libraries. The following is a benchmark created using the awesome BenchmarkDotNet  library.

I have uploaded the benchmark code to github here if you are interested in details.

Please bare in mind that performance is very dependent on your use case, so it is best to benchmark with your own workload before choosing a library.


Jsonics has support for most commonly used .net types. If you find a type you need is missing please raise an issue and I will add it.


Jsonics is a pre 1.0 alpha release and as such is missing some features, these will be added before Jsonics will be deemed production ready. These include:
  • Ignore support for properties
  • Custom ToJson/FromJson converters
  • Decimal and char type support

How do I get it?

Jsonics is available on Nuget in both Signed and Unsigned versions.

The code is available on github here under the MIT license.

Jsonics is currently in alpha quality and should not be used for production code. However feel free to try it out and report any issues you have with it.

No comments: