Skip to content

Instantly share code, notes, and snippets.

@jnizet
Created August 13, 2014 21:25
Show Gist options
  • Save jnizet/1673c66104f2348349d0 to your computer and use it in GitHub Desktop.
Save jnizet/1673c66104f2348349d0 to your computer and use it in GitHub Desktop.
public class EscapeTest {
@Test
public void jacksonShouldEscape() throws IOException {
ObjectMapper om = new ObjectMapper();
String json = "{\"name\": \"O;\\\\l-wslD6RQ5@M)\"}";
Foo foo = om.reader(Foo.class).readValue(json);
assertThat(foo.getName()).isEqualTo("O;\\l-wslD6RQ5@M)");
}
public static class Foo {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment