New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deserializing when using custom wrapper element #17
Comments
Adding unit test: can reproduce the problem as described... will try to see what gives the problem. |
Looks like there is discrepancy between expected regular name, wrapper name (for test, changing local name to be 'notes' makes test pass for example). |
Managed to fix by checking and using wrapper name for deserialization, instead of property name. |
Strange. Things work ok when annotations are added on setters, but not when added on getters... |
Ok: needed to add quite a bit more code, workarounds than anticipated, but things now work. |
I appear to still be getting this, or something similar, in 2.1.3. I've got annotations setup to correctly create this: <Root BuildVersion="1.1.1" Description="horribleformatthati'mstuckwith" DataInterchangeType="dit" Locale="local pub">
<Batch name="botched">
<Documents>
<Document DocID="hg is better" DocType="rocksml" MimeType="daddytype">
<Tags>
<Tag id="hello" TagName="icknd" TagDataType="pasta">of no value at all</Tag>
<Tag id="hello2" TagName="icknd2" TagDataType="pasta2">of no value at all2</Tag>
</Tags>
</Document>
<Document DocID="git is better" DocType="sucksml" MimeType="mummytype">
<Tags>
<Tag id="hell3o" TagName="ick3nd" TagDataType="p3asta">of no v3alue at all</Tag>
<Tag id="hello42" TagName="icknd42" TagDataType="pas4ta2">of no value at al4l2</Tag>
</Tags>
</Document>
</Documents>
</Batch>
</Root> However it can not read it back in, giving the following slightly sanitised error:
The relevant lines from the Batch object: @JacksonXmlProperty(isAttribute=true)
private String name;
@JacksonXmlElementWrapper(localName="Documents")
@JacksonXmlProperty(localName="Document")
private List<Document> documents; Let me know if I can help in any way. I'm happy to try snapshots if you deploy them to sonatype's OSS repo. |
FYI, I could, of course, serialise and deserialise in both JSON and YAML using 2.1.3. In the end having heard nothing back from you guys, I tried simple 2.6.9, and found it to not be simple at all. Then I tried XStream and it works superbly. I'm still interested in seeing this resolved, though, as I would REALLY like to use Jackson as my catch-all serialiser/deserialiser across all of XML, JSON, YAML in a single application. |
Sorry for slow response here. There are issues with List (de)serialization, and I hope they all come from a single root cause, to be fixed for Jackson 2.2. |
I'm having some issues deserializing a class that uses a @JacksonXmlElementWrapper.
This how my class looks:
And this gets serialized fine with:
This gives me something like:
But, when I now try and deserialize this using:
I get:
The text was updated successfully, but these errors were encountered: