Jackson multiple objects and huge json files

后端 未结 3 1623
长发绾君心
长发绾君心 2021-02-08 19:08

I get the feeling that the answer might be a duplicate of this: Jackson - Json to POJO With Multiple Entries but I think that potentially the question is different enough. Also

3条回答
  •  生来不讨喜
    2021-02-08 20:01

    You don't have to choose between Streaming (JsonParser) and ObjectMapper, do both! Traverse a bit with parser, but then call JsonParser.readValueAs(MyType.class) to bind individual JSON Object.

    Or, call ObjectMapper's readValue() method passing JsonParser at appropriate points. Or use ObjectMapper.reader(Type.class).readValues() and iterate that way.

提交回复
热议问题