Skip to content

Parse fails when number literals start with zero #1820

Description

@Haddy1
  • What is the issue you have?
    Parsing fails for number literals beginning with "0", e.g. time stamps

Program crashes with following Error:
terminate called after throwing an instance of 'nlohmann::detail::parse_error'
what(): [json.exception.parse_error.101] parse error at line 1, column 16: syntax error while parsing object - unexpected number literal; expected '}'

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
    auto j = "{ \"time\": 080000 }"_json;

  • What is the expected behavior?
    "080000" should be parsed as a numeral

  • And what is the actual behavior instead?
    Program crashes with error message:
    terminate called after throwing an instance of 'nlohmann::detail::parse_error'
    what(): [json.exception.parse_error.101] parse error at line 1, column 16: syntax error while parsing object - unexpected number literal; expected '}'

  • Which compiler and operating system are you using? Is it a supported compiler?
    gcc (Debian 6.3.0-18+deb9u1)

  • Did you use a released version of the library or the version from the develop branch?
    Using Release 3.7.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: invalidthe issue is not related to the library

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions