camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: @XmlElement overriding @JsonProperty
Date Tue, 01 Oct 2013 09:12:48 GMT
Hi

Did you look into this? Maybe there is a flag/option you can set in
jackson to have it favor @JsonProperty over JAXB. If so maybe there is
something we can add to camel-jackson, so you can turn this flag
on/off.

On Wed, Jul 17, 2013 at 11:57 PM, Craig Tataryn <craiger@tataryn.net> wrote:
> I'm working on a little route for my blog feed, essentially I have a route
> that looks like this:
>
> from("rss:...")
> .marshal().rss()
> .split(xpath("//item"))
> .unmarshal(jaxb)
> //do stuff to my Article object
> .marshal().json(JsonLibrary.Jackson)
>
> My problem is, when I marshal my model object to json I don't want it to
> have the same names as the element names from the XML the object was
> created from.
>
> So for instance, the model object that is created by JAXB has properties
> such as:
>
> @XmlElement(name = "encoded",namespace = "
> http://purl.org/rss/1.0/modules/content/")
> @JsonProperty("body")
> public void setBody(String body)...
>
> What appears to be happening is the json marshalling seems to be respecting
> the element name from the @XmlElement annotation instead of the name given
> in the @JsonProperty annotation.  In fact, it appears to ignore all @Json*
> annotations for any property that has an @XmlElement annotation associated
> with it.  So instead of "body": properties in my json I end up with
> "encoded": properties
>
> Has anyone else run into this?  It's pretty maddening :(
>
> Thanks,
>
> Craig
>
> --
> Craig Tataryn
> site: http://www.basementcoders.com/
> irc: ThaDon on freenode #basementcoders
> twitter: craiger



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message