Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not happy with JAX-RS JSON and XML output for List

Simon Joseph Aquilina
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I have created a class that has a list of Address. I have defined the class as follows:

With this I get valid JSON, however I am not happy with the XML output. The JSON is as follows:

For me the above JSON is correct as it reads "an array of addresses". How the XML feels wrong. It would need either to be or I opted to go with he latter and updated my code as follows:

This gives me the following:

The XML feels ok now as addresses is a a list of address. However the JSON is now "address" is a list of "address".

Does anyone know how to solve this one out? I use CXF not sure if that changes anything.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic