Comments (3)
JSON itself doesn't really have a concept of signedness, or even integer vs floating point, it is just numbers.
This library separates numbers into three categories, signed, unsigned, or floating point. This is because it has to store values in concrete data types that have defined ranges. Using three representations with partially overlapping ranges, it can store a larger range of values than if it only used one storage type. It can support the full range of integers from minimum signed value to maximum unsigned value, which is 50% more than the range of either signed or unsigned alone, and also the full range of floating point values supported by double.
This allows it to parse a number and determine if it should store it as an unsigned integer value between 0 and unsigned max, or as signed integer value between signed min and 0, or as a floating point value. It can then write that value back out again as the same number (within the limits of floating point number representations).
from json.
Is there actually an issue here, or just a difference that you've noticed? Constructing from a known type uses the signedness of that type. Parsing a number from text is unsigned unless it has a sign. What change are you asking for?
from json.
Interesting, I didn't know that's the expected behaviour when numbers are parsed from text. I think my own ignorance on the subject is the issue here then. If the difference is simply due to C++ and JSON having different concepts of signedness I'm not sure anything should change.
I'll close this issue, thank you for the quick reply to clarify this.
from json.
Related Issues (20)
- Newer serialization macros not listed in README
- Cannot use std::format on nholman::json objects HOT 8
- to_json(std::filesystem::path) can create invalid UTF-8 chars on windows HOT 2
- Parsing the unicode string got the wrong result HOT 7
- Can't run `make amalgamate` HOT 1
- JSON parses as array when assigned in initializer list. HOT 1
- Program crashes with ordered_json, but works fine with json HOT 5
- Simple example with nlohmann::ordered_json doesn't compile HOT 2
- Segfault on parse when using "#pragma pack (push, 1)" HOT 4
- Incorrect floating point parsing HOT 2
- ordered json pointer corruption HOT 5
- Rel 3.11.2 -- patch method throw exception which use to work fine in Rel 3.9.1 HOT 4
- Validatable release artifacts are not sufficient for packaging (trying to run tests) HOT 8
- Assertion failed when accessing non-existing object with const json object HOT 12
- Inconsistent behaviour of json construction using `std::initializer_list` HOT 1
- CBOR data cannot be decoded HOT 3
- Docs have incorrect info for `update()`
- gdb-pretty-print broken since m_data added
- Derived classes from json class HOT 19
- Behavioral change of serializers in 3.11.3. Name lookup related. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json.