latest posts

For some time now going back several years I have been attempting to figure out a way to make data smaller without degradation. On the flight back from a Labor Day Weekend trip to Silicon Valley I started writing out some ideas for compression. What I came to realize is that to be efficient, for each popular file type the compression should adjust to the data inside. For example, XML, there is a lot of duplication of data by design. For each element in an XML Document you essientially have the same text again to close the element. A dictionary compression would reduce file size immensely, conversely a JSON file of the same data wouldnt benefit as much.

An hour or so later I started picking apart JSON, thinking about making a transport that would be even more efficient. My solution: JCON.

While not for everyone, the solution I came up with does away with the property names entirely and braces - reducing the size even more so than JSON.

For instance take the following class:
[csharp] public class Person { public string FirstName { get; set; } public string LastName { get; set; } } [/csharp] Assume you initialize the class like so:
[csharp] var person = new Person { FirstName = "John", LastName = "Doe" }; [/csharp] With that class and then serialized you get the following size in bytes:

XML: 218
JSON: 37
JCON: 12

JCON ends up being almost 20 times smaller than XML and 3 times smaller than JSON. Wanting to make sure when dealing with collections of objects JCON continued to be efficient, assuming 100 Person objects (in bytes):

XML: 8973
JSON: 3801
JCON: 1000

Not as huge of an impact, but still almost 9 times smaller than XML and almost 4 times smaller than JSON.

Knowing data duplication can exist in the data itself outside of the data transport definition so I will be working on adding in a compression flag so no other libraries are needed on either client or server side. For example, if there are 2 or more people with the same last name or first name, then you would save a couple bytes.

As with any of my projects, this project is completely open source on my GitHub profile.