This discussion is archived
2 Replies Latest reply: Apr 16, 2013 4:56 PM by 1002901 RSS

How do I convert received JSON data back into a list of objects?

1002901 Newbie
Currently Being Moderated
I'm new to JSON.

This is my client code:

public <T> T getStuff(Class<T> responseType) throws UniformInterfaceException {
WebResource resource = webResource;
resource = resource.path("stuff");
return resource.accept(;

What I'm calling is this (this is on the server side):

public Response getStuff() {
return Response.ok(ProjectProperties.stuff).header("Access-Control-Allow-Origin", "*").build();

Just FYI (This is what the server-side code is fetching):

public static List<Object> stuff= new CopyOnWriteArrayList<Object>();


The above is all good and well...

It's the getting of the data that is failing me.

I try this (from my client code, in hope to start using the data):

RestClient rc2 = new RestClient();

List list;

try {
list = rc2.getStuff(List.class); // RESTFUL
} catch (UniformInterfaceException uie){
System.out.println("The data isn't received properly yet.");

And I get this:

// SEVERE: A message body reader for Java class java.util.List, and Java type interface java.util.List, and MIME media type application/json was not found
// SEVERE: The registered message body readers compatible with the MIME media type are:

Any idea what I'm doing wrong?

Again, the List of object is turning into JSON, then I receive it... I just need to turn it back into a list of objects, so I can use it.

Please help,

Thanks, Robert


  • Correct Answers - 10 points
  • Helpful Answers - 5 points