ignore_comment=true fails on multiple consecutive lines starting with comments #2330
Labels
confirmed
kind: bug
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Milestone
I know comments are not supported in json, but I'm trying to migrate a project that used YAJL, which has an option for allowing comments, specifically multiple consecutive lines of comments:
// description
// more description
{
...
}
I'm using the parse(...,ignore_comments=true) option, but it's failing on the second comment line. I
What is the issue you have?
Please describe the steps to reproduce the issue.
std::string ss = "//\n//\n{\n}\n";
json j = json::parse(ss,nullptr,true,true);
Can you provide a small but working code example?
std::string ss = "//\n//\n{\n}\n";
json j = json::parse(ss,nullptr,true,true);
What is the expected behavior?
should ignore both lines
And what is the actual behavior instead?
terminate called after throwing an instance of 'nlohmann::detail::parse_error'
what(): [json.exception.parse_error.101] parse error at line 2, column 1: syntax error while parsing value - invalid literal; last read: '//<U+000A>/'
Aborted (core dumped)
Which compiler and operating system are you using?
Which version of the library did you use?
develop
branch (35daa5c)If you experience a compilation error: can you compile and run the unit tests?
The text was updated successfully, but these errors were encountered: