I have a JAX-RS web service method that returns an ArrayList like this:

@GET
@Path("/some-path)
@Produces(MediaType.APPLICATION_JSON)
public ArrayList<UserProfile> fetchUsers() {

    ArrayList<UserProfile> result = ...;

    return result;
}

UserProfile class is annotated like this:

@XmlRootElement
public class UserProfile {
//...
}

Unfortunately, JAX-RS is not returning a JSON array. Instead it returns
something like this:

{{"name":"Bibhas Bhattacharya","premium":true}}

How can I get a JSON array like this?

[{"name":"Bibhas Bhattacharya","premium":true}]





--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/Serialize-ArrayList-as-JSON-array-tp4673944.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to