bytedance / bytedance/sonic-cpp

Proposal: Support parsing JSON number as RawNumber type

Open
#61 0 comments 0 reactions 0 assignees View on GitHub
proposal
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.