-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Some methods (i.e. DocumentContext's set) fail when JSON name has ' in it #171
Comments
This is fixed but you must escape the single quote in the path: @Test
public void issue_171() {
String json = "{\n" +
" \"can delete\": \"this\",\n" +
" \"can't delete\": \"this\"\n" +
"}";
DocumentContext context = using(JACKSON_JSON_NODE_CONFIGURATION).parse(json);
context.set("$.['can delete']", null);
context.set("$.['can\\'t delete']", null);
ObjectNode objectNode = context.read("$");
assertThat(objectNode.get("can delete").isNull());
assertThat(objectNode.get("can't delete").isNull());
} |
@kallestenflo thank you. Any plan to change paths returned by |
@kallestenflo any response to that? Since I am reusing results from things like |
By the way, |
Given this JSON object
Trying to run
This is a simplified example but
'
is valid in the name according to JSON standard. More over, runningwill return
and will cause issues, when trying to use the second value, e.g.
context.set(paths[1], null);
where paths is an array of paths gotten fromcontext.read("$..*")
The text was updated successfully, but these errors were encountered: