fasterxml: Unrecognized token '***': was expecting ('true', 'false' or 'null')
2541 ワード
fasterxml: Unrecognized token ‘open’: was expecting (‘true’, ‘false’ or ‘null’)
public class Test {
static final ObjectMapper ObjMpr = new ObjectMapper();
public static void main(String[] args) throws Exception {
String s = "open";
String s1 = ObjMpr.readValue(s, String.class);
System.out.println(s1);
}
}
Exception in thread "main" com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'open': was expecting ('true', 'false' or 'null') at [Source: java.io.StringReader@117c323d; line: 1, column: 9]
String s = "\"open\"";
に変更する必要があります.この場合、fasterxmlによって正しく理解されます.