Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON ArrayList in Jersey

I'm trying to return a List from jersey, which works fine in XML, but when I go to output it as JSON, it claims, "A message body writer for Java class ... and Java type ... and MIME media type application/json was not found".

I have not done any configuration for dealing with utility lists, as i thought that jersey + jersey-json-1.9 handled this stuff automagically for JSON the same way it has for XML.

Anyone else have any luck with this?

like image 942
Rannick Avatar asked Jun 25 '26 03:06

Rannick


1 Answers

I found that my first stab at this same problem failed with this error message, and the solution was as given in another SO question, Jersey: com.sun.jersey.server.impl.template.ViewableMessageBodyWriter: I had forgotten to add the jersey-json module to my project.

like image 61
metamatt Avatar answered Jun 27 '26 16:06

metamatt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!