@JacksonXmlElementWrapper
not respected when serializing Iterator
s / Iterable
s
#148
Milestone
@JacksonXmlElementWrapper
not respected when serializing Iterator
s / Iterable
s
#148
I'm using Jackson 2.5.2 to serialize objects both to JSON and XML. My use case involves serializing large dynamically generated collections, hence the need to expose an Iterator rather than a List for serialization.
Everything works perfectly with one snag:
@JacksonXmlElementWrapper
does not seem to be respected when serializingIterator
/Iterable
. I'd expect the following code:to produce:
but instead I'm getting:
Am I doing anything wrong here?
If I replace the
Iterator
with aList
, the wrapping element gets correctly added, but switching to in-memory lists is not practical in our use case. I could instead return a dummy list that returns my original iterator in theiterator()
method (and throwsUnsupportedOperationException
in all other methods), but this seems a rather ugly hack.The text was updated successfully, but these errors were encountered: