- 2 minutes read

Recently I noticed how cumbersome Json becomes if it's used to describe large quantities of simple data. Have a look at the definition of the Coffee Wheel created by (no pun intended!) Jason Davies. On the one hand, Json is a great and simple format to describe the wheel (see the source code). On the other hand, writing your own coffee wheel description is another story altogether. You have to count curly braces, square brackets, commas, and quotation marks meticulously. It almost drove me nuts.

This shows another problem of Json. It's not well suited for stream processing. Json objects are JavaScript objects, so they have to be parsed completely before you can start working. That's one of the few area XML has an edge of Json. Since 2004, XML stream processing is an official part of JavaSE.

So I became curious when I stumbled of the CSJ API of Kirit Sælensminde. I didn't try it, so I can't say anything about the quality of the implementation, but at first glance, it looks both well-thought and promising. In many cases, the Json stream object is just as simple as a traditional CSV file you can import by Excel, but it offers much more flexibility.

By the way, CSJ wouldn't simplify the coffee wheel description. The coffee wheel is a recursive data structure, so it doesn't benefit from stream processing.


Comments