Hi All,
I've been trying to figure out a good way to return both JSON
and XML for my resources. Based on the examples, it's easy but I have a
little nit that I'd like to solve. Whenever my resource returns a
collection, List<Person> for example, the roots for the XML/JSON is
never what I want it to be. For XML, I end up with "People" as the root
and with JSON, I get "person". As you can see, XML automatically
capitalizes the root node and with JSON, the "root" isn't pluralized.
I'm using the usual JAXB annotations and using jersey-json to do the
JAXB->JSON stuff but I've done anything custom. So...here are my two
questions:
1) Can Jersey be made to handle it properly so that both XML and JSON
end up with the same root? (So instead of "People" and "person", I get
"people"?)
2) If not, what options do I have to get this more like I want it?
I don't mind having to do the XML and JSON myself using utility classes
or something but with Jersey providing so much, I figured I'd get some
advice before writing more generic serializers.
Take care,
Jeremy Whitlock | Software Engineer | CollabNet, Inc.
8000 Marina Blvd. Suite 600 | Brisbane, CA 94005 | USA
O 650.228.2516 | C 970.988.8822 | jwhitlock_at_collab.net