[json-lib-user] Question about null Number serialization
Brought to you by:
aalmiray
From: Anil G. <an...@bu...> - 2008-02-05 01:04:14
|
Apologies if this is a FAQ, but I tried for some time to find it and couldn't. If I have a bean with a Long or Number property, e.g. class TestBean { private Long number = null; public Long getNumber() { return number; } public void setNumber(Long number) { this.number = number; } } and serialize an instance where the "number" property is null, for example using JSONSerializer.toJSON(new TestBean()).toString() it gives the result {"number":0} and deserializing this gives an instance that is not equal to the original. Is this expected or a bug? I was expecting a serialized form of {"number":null} which, when deserialized does give me an instance equal to the original. --a. |