一个错误Gson解析一个字符串,如“\”abc \“ab”

时间:2018-04-25 03:42:18

标签: android json

String d = gson.fromJson("\"abc\"", String.class);
String d = gson.fromJson("aa\"abc\"aaa", String.class);
they are right

String d = gson.fromJson("\"abc\"aaa", String.class);
this is wrong
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 7 path $

为什么像“\”abc \“aaa”这样的字符串格式错误的JSON?

0 个答案:

没有答案