I have a Json file that looks like this:
[
{ \"field\":\"val\" },
....
]
I have Java object representing single object and collection o
Passing an array or List type works, as @dmon answered.
For sake of completeness, there is also an incremental approach if you wanted to read contents one-by-one:
Iterator it = mapper.reader(Objects.class).readValues(in);
while (it.hasNext()) {
Objects next = it.next();
// ... process it
}
This is useful if you have huge lists or sequences of objects; either with enclosing JSON Array, or just root-level values separated by spaces or linefeeds.