Open fufufufuli opened 5 years ago
@fufufufuli , it support Jackson annotation by registering a JacksonmappingProvider:
public static final Configuration JACKSON_JSON_NODE_CONFIGURATION = Configuration
.builder()
.mappingProvider(new JacksonMappingProvider())
.jsonProvider(new JacksonJsonNodeJsonProvider())
.build();
String str="{\"xxx\":{\"math_score\":80,\"history_score\":85,\"biological_score\":75}}";
Student student = using(JACKSON_CONFIGURATION).parse(str).read("$.xxx", Student.class);
Does this library support annoation ? such as: public class Student{ @JsonProperty("math_score") private Integer mathScore; @JsonProperty("history_score") private Integer historyScore; @JsonProperty("biological_score") private Integer biologicalScore; } String str="{\"xxx\":{\"math_score\":80,\"history_score\":85,\"biological_score\":75}}"; ReadContext readContext= JsonPath.parse(str); Student student = readContext.readContext.read("$.xxx", Student.class);