Archive: February, 2018

Mind Over Matter: A Lesson from Java/JSON Conversion

I’m a Java ecosystem person but most of the code I write is Groovy. There are occasional patches of Java, but my mind is tuned in to Groovy. In a recent project I had to stay all-Java for a while. A little data structure turned up that I decided would benefit from being converted to JSON and then stored in a database.

If you didn’t know, converting to/from JSON is are one-liners i Groovy. You hardly even think about it. I had to search the ‘Net to find out how it’s done in Java these days. Gson seemed a solid candidate, but I was in for a surprise. In the end I chose a completely different approach which is also an editor’s choice.
Continue »