Skip to content
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

NULL string values when escaped backslashes are present #26

Closed
measuredweighed opened this issue Apr 6, 2015 · 1 comment
Closed

NULL string values when escaped backslashes are present #26

measuredweighed opened this issue Apr 6, 2015 · 1 comment

Comments

@measuredweighed
Copy link

This seems related to the fixes put in place for issue #24, but I'm now seeing NULL values returned for any string which contains an escaped backslash.

Given the following code I'd expect name to contain the value John\ Smith. Instead, it's returned as NULL.

JSON_Value *v = json_parse_string("{\"name\":\"John\\ Smith\"}");
JSON_Object *o = json_value_get_object(v);

const char *name = json_object_get_string(o, "name");
printf("name: %s\n", name);
@kgabis
Copy link
Owner

kgabis commented Apr 6, 2015

Hi, this is expected.
I've fixed the issue with parsing strings when using string setting functions, however it does not apply to this case. "{\"name\":\"John\\ Smith\"}" will become {"name":"John\ Smith"} before being passed to json_parse_string and, since it's not a valid json string, NULL will be returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants