-
-
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
I may not understand #507
Comments
Does it build even though intellisense is giving you an error? The intellisense compiler is different than the main compiler, so it may just be a problem with the intellisense compiler. |
It compiles but it errors. This is the error stack: Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception. |
Do you have an example of the JSON that's failing? Never mind, I see it. |
This might be your problem:
Those quotes around Star Trek should be escaped. |
The json I posted appears not to be the raw data, hang on and I'll grab the raw values. |
This is the actual data in the JSON string. The value before I was grabbing from VS' visualizer but apparently it doesn't handle it correctly. {"Title":"Star Trek Beyond","Year":"2016","Rated":"PG-13","Released":"22 Jul 2016","Runtime":"122 min","Genre":"Action, Adventure, Sci-Fi","Director":"Justin Lin","Writer":"Simon Pegg, Doug Jung, Gene Roddenberry (based upon "Star Trek" created by)","Actors":"Chris Pine, Zachary Quinto, Karl Urban, Zoe Saldana","Plot":"The USS Enterprise crew explores the furthest reaches of uncharted space, where they encounter a new ruthless enemy who puts them and everything the Federation stands for to the test.","Language":"English","Country":"USA, Hong Kong, China","Awards":"Nominated for 1 Oscar. Another 1 win & 17 nominations.","Poster":"https://images-na.ssl-images-amazon.com/images/M/MV5BODgzN2E1YjctODg5Yi00YzYwLWJjZjAtNDg2MGE2Y2MyYjBmXkEyXkFqcGdeQXVyNjM1MTQ0NTQ@._V1_SX300.jpg","Metascore":"68","imdbRating":"7.1","imdbVotes":"154,036","imdbID":"tt2660888","Type":"movie","Response":"True"} |
This still has the same issue. It's invalid JSON. |
Hmm, when I pasted it, it had the escape vals. Is that better? Edit: It appears github was also messing with my escape characters. |
Yes, much. |
You can add three backticks around your example, like this.
This is then rendered as {"foo": "bar"} |
Do you know the release number or the commit hash of the version you're using, because it's not the head of master, the line numbers don't line up. |
I can't be positive, but I think it's c7afb34 |
Reformatted, stripped namespaces, template params and paths, to make it easier to read. |
Line 817 is:
|
Do you have any more of the call stack? It seems weird to me that this error would come up in |
When I get back to the office tomorrow, I'll give the rest of the call stack. |
This is the entire stack
|
|
What is the type of |
movieObject is a json object. I believe I tried it with auto, but perhaps not. I'll give that a try after I post this but here is a larger code snippet:
Edit: I'm unable to get it to work with auto but that may be because I have no idea how to implement the auto class. |
but then you couldn't use Does the code above include line 54? If so, which line is that? |
Huh, exactly like the readme? I think what happened there is that VS was giving me a red squiggly. In my troubleshooting, I must've split that away. But like you said earlier, the compiler may not understand and I should ignore that. Anyway, now I get "type must be number, but is string" Edit: And I moved line 54 into the try. It was this printf() that you see.
|
|
gregmarr: Thank you so much, you've taught me a lot. We're not this far in the class yet, so this has been a great chance to learn. Thanks nlohmann for the library as well. |
Good observation, @gregmarr. |
Thanks @gregmarr for the support! |
Hello, I'm new to C++.
I'm using Baylor's GNU licensed socket example to pull from omdbapi.com a JSON object with information about movies. This is for a non-academic class and it's a side project just to keep me busy while the class goes over the basics.
I have a std::string JSON and it has the value of:
{"Title":"Star Trek Beyond","Year":"2016","Rated":"PG-13","Released":"22 Jul 2016","Runtime":"122 min","Genre":"Action, Adventure, Sci-Fi","Director":"Justin Lin","Writer":"Simon Pegg, Doug Jung, Gene Roddenberry (based upon "Star Trek" created by)","Actors":"Chris Pine, Zachary Quinto, Karl Urban, Zoe Saldana","Plot":"The USS Enterprise crew explores the furthest reaches of uncharted space, where they encounter a new ruthless enemy who puts them and everything the Federation stands for to the test.","Language":"English","Country":"USA, Hong Kong, China","Awards":"Nominated for 1 Oscar. Another 1 win & 17 nominations.","Poster":"https://images-na.ssl-images-amazon.com/images/M/MV5BODgzN2E1YjctODg5Yi00YzYwLWJjZjAtNDg2MGE2Y2MyYjBmXkEyXkFqcGdeQXVyNjM1MTQ0NTQ@._V1_SX300.jpg","Metascore":"68","imdbRating":"7.1","imdbVotes":"154,036","imdbID":"tt2660888","Type":"movie","Response":"True"}
This is my code:
VS has highlighted the json::parse and said "parse no instance of overloaded function". It appears to accept std::string so I'm not sure what the issue is.
Any help is appreciated.
The text was updated successfully, but these errors were encountered: