According to the wiki page of Jsonix regarding its support for xsi:type
:
When marshalling, Jsonix checks, if the value has the same type as declared in the property or element declaration
I'm wondering if there is a way to explicitly get Jsonix to generate that attribute? I was able to do that in another project by specifying the TYPE_NAME
property, i.e.
element: {
TYPE_NAME: 'mapping.Element',
xAttr1: '1',
xAttr2: '2',
content: 'some content',
},
Now i'm doing some XML exports again but the same approach doesn't work any more, i.e. i get the correct xml but the xsi:type
is missing. Here is a working fiddle using a stripped down version of my mappings, that shows how an item is unmarshalled with a type and then is being marshalled without one.