-
-
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
Reading a JSON file into an object #1537
Comments
The error message usually means that the file was not opened successfully. |
Thanks for the reply. I have the files in the same directory as the .cpp file and I'm sure I have the names right. Do I need to give the full filenames, or put them in the same directory as the .exe file? And it says "parse error". Does this kind of parse error mean that the file wasn't opened successfully, then? |
Oh, another thing: ifs1 >> latest_data;
ifs2 >> current_data; |
Okay, thanks. Deleted them. What about the parsing error, then? Is there a problem with the filename or something? |
Is it still there? To which line does the debugger send you? |
The exception is still there, but my debugger keeps trying to find chkstk.asm which my computer doesn't have so I can't debug it. I have the files in the same directory as the source code file. Should I give the full path to the files if I keep them there? |
There is no relationship between the source code directory and a file you read from disk at runtime. If you don't use a path, then it's probably trying to read the file from the current directory. That is probably the directory where your binary is located. The |
The files are in the same directory as the source code. Putting the path to the file in there helped. But now I have an exception error saying, "[json.exception.type_error.302] type must be string, but is object". What's the Edit: I decided to put the JSON files in the same directory as the .exe file so that I could use just the filename rather than putting full path to the file along with the name. Edit2: I have .json files that each have an actual JSON object in them. I need to read that object into a |
Hi, everyone.
I want to read a JSON object file and store it into an object in my code. I have two such objects that I want to read into.
This is the code I have for this:
Right now I have a JSON parse exception with the string being "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal". I'd like some help in figuring out why and in fixing this problem.
I'm Windows 10 Home Single Language version 1803 build 17134.648, x64. The compiler is MSVC version 19.16.27027.1 with Visual Studio 2017.
I have the version in the latest branch: version 3.6.1.
I saw a closed issue about this from before, but what I tried is the same as the answer to that issue and it's not working, so I opened a new issue.
The text was updated successfully, but these errors were encountered: