json « jaxb « Java Enterprise Q&A

1. How do I marshal nested lists as JSON using Jersey? I get an array of nulls or an array of one-element dictionaries containing an array    stackoverflow.com

I'm working on a project which uses Jersey to convert objects to JSON. I'd like to be able to write out nested lists, like so:

{"data":[["one", "two", "three"], ["a", "b", "c"]]}
The object ...

2. Binding a JSON to a Java class using JAXB    stackoverflow.com

I have the following JSON, where can be either true or false:

{"flag1":<boolean value>, "flag2":<boolean value>}
And I have tried to bind it to a Java class using Jersey and the following ...

3. Jersey / JAXB: Unmarshaling of empty json array results in a list with one item where all fields are set to null    stackoverflow.com

I have a really simple rest web service returning a list of questions. This code works as expected when the number of questions returned are greater than zero. But if the ...

4. Binding a Generic Java Class to a JSON using JAXB    stackoverflow.com

I have the following java class

public static class EnvelopeClass<T> {

    public String version;

    public T data;


5. RESTful 1-N optional relationships    stackoverflow.com

I trying to learn how to write RESTful apps in Java using Jersey and Hibernate, and I'm struggling to understand how to handle parent/child type relationships when POSTing data to a Resource. I'm ...

6. Jersey @Provider not recognized    stackoverflow.com

We are using a Jersey JAXBContext resolver implementation using @Provider. It appears that Jersey is not recognizing the @Provider class - the code is never being executed. ...

7. Jersey JSON marshalling of empty lists    stackoverflow.com

We have a Java List of objects which is marshalled via JSON which is created by Jersey. The List is called "rows". When there is data we have:

When there is no ...

8. JAXB JSON force brackets on arrays    stackoverflow.com

I'm trying to force brackets on lists that contain only one element. I want something like this:
{"id":"0","industries":[{"id":"0","name":"Technologies"}],"name":"Google Inc."} But I get:
{"id":"0","industries":{"id":"0","name":"Technologies"},"name":"Google Inc."} Here is my Entity:

public class Company {
 private int id;

 private String ...

9. Could not find JAXBContextFinder for media type: application/json    stackoverflow.com

I have a problem with development resteay+ejb+json. Using Jboss-5.1.0.GA. I get example from resteasy-jaxrs and adapted to use for my case. Added jars(this ask me jboss. in other case catch exception ...

10. Error passing single element JSON array in Jersey 1.5    stackoverflow.com

I have a Books class with ArrayList of BookMeta objects , the name of the arraylist is bookList. If the bookList holds more than one BookMeta, it works good for the clients ...

11. How does JAXB to JSON (and vice versa) work using Jersey?    stackoverflow.com

I have successfully implemented a restful service that works with my own client. Now, I wish to make it a service that other clients can also interact with it. In this ...

12. jersey (+ jackson) map field serialization    stackoverflow.com

i have a simple jersey web service and i'd like to consume / produce objects that contain map fields, like

private Map<String,String> properties;
if this string goes into the web service,
{ properties: { ...

13. Consume JSON Object in PUT Restful Service    stackoverflow.com

I'm trying to implement a RESTful Service in Java that receives a JSON Object through a PUT request and automatically maps into a Java Object. I managed to do this in ...

14. Java.util.Map to JSON Object with Jersey / JAXB / Jackson    stackoverflow.com

I've been trying to create a Jersey REST Webservice. I want to receive and emit JSON objects from Java classes like the following:

public class Book {

    public String ...

15. how to use some indirection when unmarshalling json to java bean using Jersey using jaxb annotations    stackoverflow.com

I'm trying to unmarshall some received json (from Jira restful web service). Problem is: an "issue" has a "summary" property and a list of fields. Summary is not present as an attribute ...

16. JSON Jersey JAXB    stackoverflow.com

I cant seem to post JSON to my webservice but XML works fine:

 public  void addOrder(JAXBElement<OrderBean>  order) {

17. How to configure json format when using jaxb annotations with jersey    stackoverflow.com

I am using jersey to expose a service which uses jaxb annotated classes to configure the look of the json. I am trying to include the type directive in each json element. ...

18. Error when trying to convert JSON to POJO using Jersey    stackoverflow.com

I'm doing this :

WebResource resource = client.resource(urlStr); 
resource.accept(MediaType.APPLICATION_JSON_TYPE, MediaType.APPLICATION_XML_TYPE); GenericType<List<EMailInformations>> genericType = new GenericType<List<EMailInformations>>() {};
List<EMailInformations> response = null; 
    response = resource.get(genericType); 
} catch (UniformInterfaceException ue) ...

19. Unmarshal JAXB-Annotated Classes from JSON using Jersey and Jackson    stackoverflow.com

I have a class that has JAXB and bean validation annotations, much like the following:

@XmlType(namespace = "urn:com:company:assessment")
public class Assessment
    // ...


20. JSON serialization in Jersey - How to ignore XmlJavaTypeAdapter for serializing a map?    stackoverflow.com

In my Jersey-based REST webservice I need to provide xml and json output. The class Result has a map, annotated with XmlJavaTypeAdapter to correctly serialize it to xml.

public class Result {


21. Marshalling an empty collection to json using jersey    stackoverflow.com

I have a strange issue marshalling an empty object collection to json using jersey with the jaxb based json support. My object looks like

@XmlWrapper(name = "stuff") @XmlElement(name = "s")
private List<Foo> foos;
Marshaling ...

22. jersey JAXB JSON single-element array    forums.netbeans.org

Hi, I'm using GlassFish V2 with jersey 1.0 and JAXB. I have RESTful Web Service which expose several resources. I'm using container-item pattern. My problem is that when the container converter ...