Re: [jackson-user] How to use type name as element name

2017-03-27 Thread Tatu Saloranta
On Sat, Mar 25, 2017 at 6:07 AM, Zsolt Balanyi wrote: > Hi Tatu! > > After long investigation I found out that the order of operations in > JacksonXmlModule.setupModule matters: > > public void setupModule(SetupContext context) { >

Re: [jackson-user] How to use type name as element name

2017-03-23 Thread Tatu Saloranta
On Thu, Mar 23, 2017 at 11:34 AM, Zsolt Balanyi wrote: > Hi! > > Unfortunately none of the approaches worked... XmlBeanSerializerModifier has > a bug, and does not use the provided modifier, even if I override the method > you mentioned. > Could you help me where to

Re: [jackson-user] How to use type name as element name

2017-03-23 Thread Zsolt Balanyi
Hi! Unfortunately none of the approaches worked... XmlBeanSerializerModifier has a bug, and does not use the provided modifier, even if I override the method you mentioned. Could you help me where to report the bug? Also where can I find some resources on the architecture of the Jackson

Re: [jackson-user] How to use type name as element name

2017-03-22 Thread Tatu Saloranta
On Wed, Mar 22, 2017 at 1:31 AM, Zsolt Balanyi wrote: > Hi! > > The tag name can be easily renamed, by > > if (gen instanceof ToXmlGenerator) { > ((ToXmlGenerator)gen).setNextName(new > QName(bean.getClass().getSimpleName())); > } >

Re: [jackson-user] How to use type name as element name

2017-03-22 Thread Zsolt Balanyi
Hi! The tag name can be easily renamed, by if (gen instanceof ToXmlGenerator) { ((ToXmlGenerator)gen).setNextName(new QName(bean.getClass().getSimpleName())); } doNormalSerialization(); The only problem is, that I need to serialize all other fields, which

Re: [jackson-user] How to use type name as element name

2017-03-21 Thread Zsolt Balanyi
Hi! That was one of my first attempts :) The question is how could I ommit the uiElement nodes? BR, Zsolt 2017. március 20., hétfő 20:16:38 UTC+1 időpontban Tatu Saloranta a következőt írta: > > Have you tried choice of

Re: [jackson-user] How to use type name as element name

2017-03-20 Thread Tatu Saloranta
Have you tried choice of `JsonTypeInfo.As.WRAPPER_OBJECT`? That does add type id as property-name "wrapper" in JSON, and should work quite similarly with XML. The main problem with XML is often, however, that the root value requires additional extra XML element. -+ Tatu +- On Mon, Mar 20, 2017

Re: [jackson-user] How to use type name as element name

2017-03-20 Thread Zsolt Balanyi
Hi! public class Page { public UIElement uiElement; } @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") public abstract class UIElement { } public class StackLayout extends UIElement { public List uiElements = new ArrayList<>(); }

Re: [jackson-user] How to use type name as element name

2017-03-20 Thread Tatu Saloranta
What is the POJO you are serializing? -+ Tatu +- On Mon, Mar 20, 2017 at 5:11 AM, Zsolt Balanyi wrote: > Hi! > > I have a structure that outputs this: > > > > > > > > > I use @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=As.PROPERTY, >

[jackson-user] How to use type name as element name

2017-03-20 Thread Zsolt Balanyi
Hi! I have a structure that outputs this: I use @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=As.PROPERTY, property="type") on the common base class. How could I get the following output: It does not matter, if it can not be deserialized by Jackson, it