Posts Tagged: jackson

  • Programming

    Writing CSV using Jackson CSVMapper & Mixin annotations

    Posted on by

    A while back I wrote a post on how not to parse CSV using Java.  It included a few pointers on how to pull CSV data into an application but not how to spit it back out.  I thought I’d write a quick post on writing CSV and a few best practice pointers that will help… Read more »

  • Programming

    Battle of the tokenizers – delimited text parser performance

    Posted on by

    An interesting question about StringTokenizer popped up on stackoverflow the other day.  It was essentially about how to optimise reading delimitated data, in this case lines of integers separated by lines of spaces. It demonstrated three things. Don’t fixate on micro-optimisations when you probably have big bottlenecks elsewhere String.split() is really slow The difference is… Read more »

  • Programming

    Deserialising JSON or XML to a Map using Java

    Posted on by

    Well, here’s a thing.  Imagine you have some XML or JSON that looks like a map, only you don’t know the names or number of the properties in advance.  For example:

    Or some JSON that looks like this:

    How can you do it?  Using Jackson @JsonAnyGetter and @JsonAnySetter . All you need is the XML root… Read more »

  • Programming

    How not to parse CSV using Java

    Posted on by

    I’ve only been on StackOverflow for a short while and already feel like I’m drowning under the the sheer quantity of people asking how to parse CSV.  Most of them start in one a few ways.  So, for the record, here’s how you don’t do it. Don’t use regular expressions That’s right.  You don’t use… Read more »