How to deserialize JSON file starting with an array in Jackson?

后端 未结 3 1828
我寻月下人不归
我寻月下人不归 2020-12-18 18:43

I have a Json file that looks like this:

[
    { \"field\":\"val\" },
....
]

I have Java object representing single object and collection o

3条回答
  •  没有蜡笔的小新
    2020-12-18 19:25

    You can directly get a list through the following way:

    List objs =  
        mapper.readValue(in, new TypeReference>() {});
    

提交回复
热议问题