All: after further review of the "extend JacksonJsonProvider" solution, I
found the answer that suited me, which was extending
ResteasyJackson2Provider: http://stackoverflow.com/a/23437874/4597638



On Fri, Mar 13, 2015 at 2:05 PM, Dave J <devdevdata...@gmail.com> wrote:

> Hello,
>
> After searching all over for info on this, I thought I would ask and see
> if anyone has tried this and possibly succeeded with it....
>
> I have a POJO I set up to be provided as XML or JSON depending on the
> user's request.
> Class looks something like this...
>
> @XmlRootElement(name="aaa")
> public class AAA {
> ....
> }
>
> As XML it comes back fine, with the outermost tags being <aaa>....</aaa>
>
> However, when I add the @JsonRootName(value="aaa") at the same spot, I
> don't end up with JSON along the lines of {"aaa": .... } or "aaa": {} --
> there is simply no mention of the intended "root element" and I end up with
> just { ... }
>
> I've seen a couple possibilities for dealing with this:
> - Jettison may deal with this annotation better than Jackson?
> - It is possible to extend JacksonJsonProvider, overriding the
> writeTo method, grab the mapper and set the SerializationFeature
>  WRAP_ROOT_VALUE -- tried this, didn't have any joy
>
> Maybe I should start with, is there some reason this doesn't work out of
> the box like many other annotations do? Or perhaps I'm just using it wrong?
>
> Thanks so much.
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to