以下是我收到的错误消息:
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('-' (code 45)): Expected space separating root-level values
at [Source: (String)"2018-10-10"; line: 1, column: 6]
下面是我的 UPDATED 代码,用于读取邮递员Json的日期:{“ modifiedDate”:“ 2018-09-10”}
String modifiedDateJson = data.get("modifiedDate").asText();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = dateFormat.parse(modifiedDateJson);
String output = dateFormat.format(date);
Date modifiedDateDf = mapper.readValue(modifiedDateJson,Date.class);
LocalDate modifiedDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();