1.

Why Are My Long Values Incorrect In Javascript?

Answer»

JAVASCRIPT does not know about integer values. All numbers are represented with double precition floats using 64 bits (IEEE 754). These types cannot represent technically the complete value range of 64-bit integers like Java's Long. With the JsonWriter you have the possibility since XStream 1.4.5 to set IEEE_754_MODE to force any long value that is not representable as JavaScript number to be written as STRING value in JSON. With the Jettison-based JettisonMappedXmlDriver you may either set a DIFFERENT TypeConverter or force the default converter to write integer values out of the range of 32-bit ALWAYS as string setting the system property jettison.mapped.typeconverter.enforce_32bit_integer to true (not available for Jettison 1.0.1 and Java 1.4).

JavaScript does not know about integer values. All numbers are represented with double precition floats using 64 bits (IEEE 754). These types cannot represent technically the complete value range of 64-bit integers like Java's Long. With the JsonWriter you have the possibility since XStream 1.4.5 to set IEEE_754_MODE to force any long value that is not representable as JavaScript number to be written as string value in JSON. With the Jettison-based JettisonMappedXmlDriver you may either set a different TypeConverter or force the default converter to write integer values out of the range of 32-bit always as string setting the system property jettison.mapped.typeconverter.enforce_32bit_integer to true (not available for Jettison 1.0.1 and Java 1.4).



Discussion

No Comment Found