Commit 95732149 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '1.5.x' into 2.0.x

parents bff93a67 ccbbe0f0
......@@ -113,9 +113,16 @@ public class BasicJsonParser extends AbstractJsonParser {
int inObject = 0;
int inList = 0;
boolean inValue = false;
boolean inEscape = false;
StringBuilder build = new StringBuilder();
while (index < json.length()) {
char current = json.charAt(index);
if (inEscape) {
build.append(current);
index++;
inEscape = false;
continue;
}
if (current == '{') {
inObject++;
}
......@@ -135,6 +142,9 @@ public class BasicJsonParser extends AbstractJsonParser {
list.add(build.toString());
build.setLength(0);
}
else if (current == '\\') {
inEscape = true;
}
else {
build.append(current);
}
......
......@@ -170,4 +170,11 @@ public abstract class AbstractJsonParserTests {
this.parser.parseList("\n\t{}");
}
@Test
public void escapeQuote() {
String input = "{\"foo\": \"\\\"bar\\\"\"}";
Map<String, Object> map = this.parser.parseMap(input);
assertThat(map.get("foo")).isEqualTo("\"bar\"");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment