Skip to content

Numeric type classified as string #659

@NiN9876

Description

@NiN9876

Describe the bug
Numbers with large number of digits are classified as strings

Enumerate the steps to reproduce the bug

Include a small, self-contained example if possible
Running this code

  auto parsed = jsoncons::json::parse(R"({"a": 123456789012345678901234567890})");
  std::cout << "is_string:      " << (parsed["a"].is_string() ? "Yes" : "No") << std::endl;
  std::cout << "is_string_view: " << (parsed["a"].is_string_view() ? "Yes" : "No") << std::endl;
  std::cout << "is_number:      " << (parsed["a"].is_number() ? "Yes" : "No") << std::endl;

produces the following output

is_string:      Yes
is_string_view: Yes
is_number:      Yes

What compiler, architecture, and operating system?

Visual Studio 2022 on Windows 11,
Toolset: Visual Studio 2022 (v143),
C++ Language Standard: Preview - ISO C++23 Standard (/std:c++23preview)

What jsoncons library version?

  • Latest release 1.4.3
  • Other release ______
  • master

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions