public static <T> T jsonToBean(String json,Class<T> tClass){ try { //可以转换单引号 mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES,true); //键可以不用引号包裹 mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES,true); return mapper.readValue(json,tClass); } catch (JsonProcessingException e) { e.printStackTrace(); } return null; }