-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse error #1761
Comments
What is the exact exception description? |
Message with exception have only address in memory. Debugger stop program in case 4: in
|
You should still be able to access the
|
For more detail, I wrote a simple program. It first writes the information to a file, and then reads it. An error occurs at the reading stage.
The In https://nlohmann.github.io/json/classnlohmann_1_1basic__json_af1efc2468e6022be6e35fc2944cabe4d.html Error 101 describes is an invalid format. But the file is written using the library functions. Perhaps I am writing incorrectly? |
I can reproduce the exception. I'll try to dig deeper later this week. |
I'm running into a similar exception as @xabik mentioned. Weirdly if I have my json in "beautified" mode when loading it parses correctly, using any online tool to minify (or writing it by hand) and the same exact json hits that exception. So I decided to break that minified json into a 2 line and now it loads. |
@DJLink, can you attach file with json which loads correctly? I try to repeat loading. |
Here are 3 files, the single line file fails, the other load ok. I'm using nlohmann::json::parse() |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This comment has been minimized.
This comment has been minimized.
I had another look at #1761 (comment). The issue is that {"coordinates":{"lt":{"x":52,"y":121},"rb":{"x":140,"y":43}},"order":1,"type":19}
{"coordinates":{"lt":{"x":55,"y":118},"rb":{"x":137,"y":46}},"order":3,"type":21}
Hence, you would need code like try {
while (f >> building) {
info.push_back(building);
}
} catch (json::exception&)
{} to parse an arbitrary number of JSON values in a file. |
Do you need further assistance with this issue? |
When I execute this function, I get an exception like
nlohmann :: detail :: parse_error
file info.json with info like this
but if i change my function to:
function work good. How i can fix this?
MS Visual Studio 2017. Windows 7.
Version library 3.7.0 Release
The text was updated successfully, but these errors were encountered: