I am trying to parse using Jackson
mapper to parse big JSON to java object. I have very big JSON but came across this little piece in it and not sure how to parse.<
Create one json pojo mapper class
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"coordinates"
})
public class Example {
@JsonProperty("coordinates")
private List>> coordinates = null;
@JsonIgnore
private Map additionalProperties = new HashMap();
@JsonProperty("coordinates")
public List>> getCoordinates() {
return coordinates;
}
@JsonProperty("coordinates")
public void setCoordinates(List>> coordinates) {
this.coordinates = coordinates;
}
@JsonAnyGetter
public Map getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
Then convert jsonString to pojo
Gson gson = new GsonBuilder().create();
Example r = gson.fromJson(jsonString, Example.class);