-
-
Notifications
You must be signed in to change notification settings - Fork 228
XmlMapper cannot correctly map Map #611
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
Comments
What Jackson produces is what is intended (so it is a feature not bug). To get output you want (which has extra |
Okay I guess for very simple string key this intended thing is okay, but in my case, the key of my map is a string representing a path so it contains '/'. It will be written into <> and then cause parse error in deserialization. For example if the path is "/path", the serialized XML will have Moreover, if the key is user defined complex type, it will mess up the XML syntax further. In general I think you should probably change the default behavior for map? Because it's causing bugs for some use cases like this. |
@HenryYihengXu The question of XML names being invalid is valid, although fix itself cannot be done (nor needs to be done) for just Map values (since format module operates below But one databind-level solution could be to allow alternate One possible solution added in 2.14 was #531 . |
At this point behavior works as intended: if alternate behavior is desired, can file a new issue requesting for specific alternate serialization, along with suggested usage (there has to be some way to opt in to different structure -- current handling needs to remain default for backwards compatibility). |
I have an object with a map field and I want to map it to a XML file. However, the resulting XML file does not contains pairs like normal XML. Instead, it treat each key as a data type and each value as the value of that data type. For example, I have
I get
But it is supposed to be
Do you know how to solve this issue?
The text was updated successfully, but these errors were encountered: