FasterXML / FasterXML/jackson-core
Support writing only (some?) longs as strings (opt-in) for Javascript compatibility
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 928
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 24
Description
Although Jackson exposes a [WRITE_NUMBERS_AS_STRINGS](https://javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.15.2/com/fasterxml/jackson/core/json/JsonWriteFeature.html#WRITE_NUMBERS_AS_STRINGS) feature that forces all regular number values to be written as JSON Strings rather than JSON Numbers, it doesn't currently provide a way to write **only** 64-bit integers using their canonical representation, which poses a problem for strict downstream parsers given the limitation of the maximum value to [2^53 - 1](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) ([alt](https://developers.google.com/discovery/v1/type-format)) in JavaScript, whereas this value is for instance [2^63 - 1](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) in Java.
Related specs:
- https://www.rfc-editor.org/rfc/rfc7159#section-6,
- https://262.ecma-international.org/5.1/#sec-8.5.
Related issues:
- https://github.com/FasterXML/jackson-core/issues/1037,
- https://github.com/FasterXML/jackson-databind/issues/911,
- https://github.com/HubSpot/jackson-datatype-protobuf/pull/77,
- https://github.com/HubSpot/jackson-datatype-protobuf/pull/98.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.