json串转json对象的时候,转义符导致不能正常解析..
Exception in thread "main" com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 29 path $.data
at com.google.gson.internal.Streams.parse(Streams.java:60)
at com.google.gson.JsonParser.parse(JsonParser.java:84)
at com.google.gson.JsonParser.parse(JsonParser.java:59)
at com.google.gson.JsonParser.parse(JsonParser.java:45)
at zh.main(zh.java:17)
Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 29 path $.data
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1568)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:491)
at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:414)
at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:722)
at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:698)
at com.google.gson.internal.Streams.parse(Streams.java:48)
... 4 more
解决代码如下:
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class zh {
public static void main(String[] args) throws Exception {
String secret ="RVLiqsbZmP00VEccALok4+xQaT6WXprZEb+SnoxBTT1zoCQVcQq3agR0/hFtgpk9oK6oxPpc9xk56l2jdZb8XO1i5xam0ApTpP9s/wOrnbiLOy92XqYYMSXH7xVzRf4irqWmhc1GY94+ZQpSY5UsrvvnbseWuObwbFwr7RPdVXp8tkSJCvKcY3531hHKPvokFwu0JnxeP803rLfkQjcvPL6lQYSA5drCZEmjhvCVtmgFy7XfbPie6QEASElTNGMCkkQpYT2W45Qa1PNnxFgPVDEpvOZYrIXm49kKfOCDRRGbs3AVTCqx9XFthw3UJ0PW0CXwQ79945cofxbIBecSeBZ1fqUd/M5GMnzakRyaR+4e0J1VRu