nlohmann / json

JSON for Modern C++
https://json.nlohmann.me
MIT License
42.18k stars 6.65k forks source link

Parsing array error #3968

Closed gllonch closed 1 year ago

gllonch commented 1 year ago

Description

I'm using your library which is working pretty well but I have an small issue.

When I'm trying to parse a array of number, I have a strange error.

Reproduction steps

string strJson = "[0600,1000,1001,8297]" json::parse(strJson)

Expected vs. actual results

Array of 4 numbers.

Minimal code example

If I'm doing this, it's working: 

string strJson = "[600,1000,1001,8297]"
json::parse(strJson)

But if I'm adding a '0' on first number, it's not working:

string strJson = "[0600,1000,1001,8297]"
json::parse(strJson) -> Exception.

Error messages

No response

Compiler and operating system

Microsoft Visual C++ 2022

Library version

3.11.2

Validation

nlohmann commented 1 year ago

Leading zeros are not allowed in JSON.