bytedance / bytedance/sonic-cpp
Proposal: Support parsing JSON number as RawNumber type
- Dominant language
- C++
- Stars
- 976
- Forks
- 127
- PR merge metrics
- No merged PRs in 30d
Description
In order to parse JSON numbers with full precision and improve parsing performance, we propose adding a new `RawNumber` type for representing parsed JSON number values.
The design of this feature includes the following steps:
1. Add a new `kRawNumber` enum to represent JSON number values, and add a `RawNumber`class to distinguish it from `stringview` type.
2. Provide support for construct, modifying, copying, and comparing `RawNumber` values. Especially, validate the number in construct and set API, because the number is from the user and maybe invalid numbers
3. Use `IsRawNumber` to check for the presence of a `RawNumber`, while `IsNumber` continues to check for numeric types.
**Implementation branch:** #60
Status: To be reviewed.
Contributor guide
Assessment
This issue has not been assessed yet.