Add support for high-precision numbers in UBJSON encoding #2286
Labels
aspect: binary formats
BSON, CBOR, MessagePack, UBJSON
kind: enhancement/improvement
release item: ⚡ improvement
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Milestone
Feature Request
UBJSON is designed to support mapping from any JSON value. For numeric values specifically, it has a high-precision numeric value to represent any number: http://ubjson.org/?page_id=422#numeric
Currently nlohmann::json does not support that data type so users have to use other binary serialization formats. However, none of the other supported formats are as flexible as UBJSON in representing JSON values and have other limitations.
Can you provide a small but working code example?
json j1 = 11111111111111111111ULL;
auto v = json::to_ubjson(j1);
json j2 = json::from_ubjson(v);
What is the expected behavior?
Support storing uint64 numbers as high-precision numbers: http://ubjson.org/?page_id=422#numeric
And what is the actual behavior instead?
integer number 11111111111111111111 cannot be represented by UBJSON as it does not fit int64
Which version of the library did you use?
develop
branchThe text was updated successfully, but these errors were encountered: