Tag: null

Here you can see a listing of all the posts tagged with null on this website.

  • Default value handling with Json-lib

    Posted on Feb. 9, 2008 at 13:19 +0100 Tagged with , , ,

    As part of a project I'm working on I'm currently moving tons of data between servers and clients using JSON. Since all components are written in Java I was looking for a simple yet customizable JSON library and eventually ended up using Json-lib which let's you easily serialize a JavaBean into a JSON-string. While looking through the network traffic yesterday, I noticed a small problem, though: When you convert for instance an Integer property of the bean and this Integer is currently a null-pointer, Json-lib will make a 0 out of it. While in most cases probably a good idea, in my particular case it's simply the wrong way of handling the null-reference since 0 has a different semantic in that particular bean.

    [more ...]

    0 comments