Comma Separated JSON: CSJ.NET

It’s an interesting concept to dodge many of the ambiguities involved in raw CSV files, while maintaining the benefit that a parser can work line by line instead of having to load a 10GB file into memory.

Some of the benfits over typical CSV implementations are that it:

  • Defines a date format
  • Allows a null literal that won’t get parsed as the string "null".
    • null also removes the ambiguity with empty cells: is ,, supposed to be an empty string or a null value?
  • New lines and other characters are escaped according to JSON encoding rules instead of whatever the CSV implementer feels like doing
  • embedded arrays or objects inside of a cell

It’s a simple enough format that you can build a serializer and deserializer out of existing JSON libraries in just a few minutes.

I’ve created (what I think is) the first .NET implementation of CSJ on Github. It’s not quite done yet, though version 0.0.1 is on Nuget.

I don’t know if CSJ will ever become a widespread format, but I do think its intriguing. If you only use simple types (string, number, bool) then its output is largely backwards compatible with existing CSV readers.