failed to deserialize all interleaved elements for list
See original GitHub issuePOJO:
@JacksonXmlRootElement(localName = "a")
public class A {
public static class B {
@JacksonXmlProperty(localName = "id")
public String id;
}
@JacksonXmlProperty(localName = "b")
@JacksonXmlElementWrapper(useWrapping = false)
public List<B> bList;
}
XML:
<a>
<b><id>id1</id></b>
<any-tag/>
<b><id>id2</id></b>
</a>
It’s expected to get two elements ‘id1’ and ‘id2’ in bList, but only ‘id2’ is available after deserialisation.
related links:
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Serialize parallel arrays to XML in C# in a specific order
Xml Sequence deserialization with RestSharp shows how to use an [XmlAnyElement] property to generate an interleaved list of elements.
Read more >Encoding Techniques in Verified Serializers - Ethan Shea
Before deserializing each element, it must be known that it actually is an element of the list, and not some other data coming...
Read more >JSON Deserialize Error : Expected '[' at the beginning of List/Set
You are trying to serialize a single object json to List<SObject> . Convert your JSON back to its original form which is not...
Read more >tf.data.Dataset | TensorFlow v2.11.0
Returns an iterator which converts all elements of the dataset to numpy. Use as_numpy_iterator to inspect the content of your dataset. To see...
Read more >Encoding | Protocol Buffers - Google Developers
Encoding · A Simple Message · Base 128 Varints · Message Structure · More Value Types · Embedded Messages · Optional And Repeated...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pswulius one thing that 2.9 will add in
jackson-databind
is@JsonMerge
like so:which would not reset value, so multiple segments would effectively be merged. I have not tried that with XML module but in theory it should work. Before 2.9 you could still add “setPoints(List<> p) { }” method that similarly appends entries, but that is bit more intrusive.
This assuming that problem is not due to mixed content (that is, no unwrapped text/cdata sections), but due to disjoint sequences of elements with same name.
Since there is a work-around (or two) but no clear path on how to solve this in other ways, will close the issue: should be possible for users to find work-arounds on closed issue.