You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I'm getting 'lacks ending quotation before the end of string' error in line
document.ParseInsitu<0>(buffer).HasParseError()
Here is my code
Document document;
#if 0
// "normal" parsing, decode strings to new buffers. Can use other input stream via ParseStream().
if (document.Parse<0>(json).HasParseError())
return 1;
#else
// In-situ parsing, decode strings directly in the source string. Source must be string.
char buffer[sizeof(json_string)];
memcpy(buffer, json_string, sizeof(json_string));
if (document.ParseInsitu<0>(buffer).HasParseError())
{
const char * error = document.ParseInsitu<0>(buffer).GetParseError();
return "";
}
#endif
if (!document.IsNull())
{
if (document.HasMember("access_token"))
{
return document["access_token"].GetString();
}
}
and here is the json
{
"access_token": "mytoken",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "token",
"refresh_token": "mytoken"
}
It's valid json.
Please advise!
Original issue reported on code.google.com by [email protected] on 31 Mar 2015 at 9:06
The text was updated successfully, but these errors were encountered:
What's the definition of "json_string"? Maybe your "sizeof(json_string)" if
wrong?
The parsing code you used is copied from the tutorial. But (mem)copying the
buffer before doing insitu parsing usually doesn't make much sense in real
code. I'd suggest that you just do the "normal" parsing instead.
Original issue reported on code.google.com by
[email protected]
on 31 Mar 2015 at 9:06The text was updated successfully, but these errors were encountered: