I\'ll start directly with my question and later on I give more background information.
Simple: I hava a LinkedHashMap
You can create two classes
@XmlAccessorType(XmlAccessType.FIELD)
public class Document {
@XmlElement
private String title;
@XmlElement
private String id;
@XmlElement
private int version;
}
@XmlAccessorType(XmlAccessType.FIELD)
public class MapJson {
@XmlElement
private LinkedHashMap documents;
}
and cobvert Object to JSON usingg
Jackson
new org.codehaus.jackson.map.ObjectMapper().writeValueAsString(instanceofMapJson);
Google JSON
new com.google.gson.Gson().toJson(instanceofMapJson);
PS. Using google json, you can remove xml annotations from your classes