Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.8.0
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Currentl ObjectMapper only has readValue() method, which the tree (or subtree) starting from the currently pointed to stream event (or if there isn't one, by advancing to the first one).
This is good for many use cases, but not all. For large documents, a more common usage pattern is one where a json array/list is traversed, and elements are individually bound.
It seems like an obvious convenience method here would cover this use case: something like:
Iterator<T> readValues(JsonParser jp); // and other variations, different source
that would return an iterator, which returns Objects created by binding each array element in sequence.
Implemented by adding ObjectMapper.readValues(), ObjectReader.readValues(), which allow binding of sequences of values. Sequence can be root-level value sequence, or arrays; if current token is START_ARRAY iteration is over values contained.