Parsing a subset of JSON in Java using Jackson

前端 未结 3 1022
谎友^
谎友^ 2021-02-14 22:15

Given a Json, is it possible to use Jackson to only parse out a section of the message? Say that the data I\'m interested in is buried in a deep hierarchy of fields and I simply

3条回答
  •  一生所求
    2021-02-14 22:51

    You can use JsonPath library. With this library you can map your JsonPath output directly into POJO's.

    Pseudo:

    List phoneNrs = JsonPath.parse(json).read("$.my.deep.structure.persons.phoneNumbers", List.class);
    

提交回复
热议问题