Open GoogleCodeExporter opened 9 years ago
It's not guaranteed to be equal: some meta info such as data type will be lost
when serializing Java Object to JSON literal. For example, if we have a
java.lang.Long with value 123, when generating JSON, it will output the value
123 itself without any type info, now if we want to read it back to Java
object, we have no way to know if we should make it a Long or an Integer.
Original comment by fangyid...@gmail.com
on 21 Feb 2012 at 5:32
Right but that's why I normalized it on the way in. You have to pick a type
(longs and doubles it seems) when you are deserializing, may as well normalize
the numbers on the way in to match their deserialized counterparts.
Original comment by she...@zaxasoft.com
on 21 Feb 2012 at 5:35
If the value of an int or short or long is 123, the value stored in JSON is
"123". While you have insufficient information to return the value "123" as an
int rather than long, you can determine that the converted values are
identical.
The Map comparison should not check the Java objects, but rather the JSON
ordinal values to be compared.
Original comment by mcv...@gmail.com
on 21 Feb 2012 at 5:52
Well, I accept it as an enhancement to override the "equals" of JSONObject to
make it compare values instead of objects, if it's the case of this request.
Original comment by fangyid...@gmail.com
on 21 Feb 2012 at 11:45
That would definitely help. Thanks!
Original comment by she...@zaxasoft.com
on 22 Feb 2012 at 3:30
Original issue reported on code.google.com by
shea...@gmail.com
on 19 Jan 2012 at 5:32