0

I'm trying to create a json object in this particular format below using via a GET to a Spring MVC controller. I have this working for a fairly simply class that produces an array which is flat - but not sure which fields I need on the Polydata class to produce the below Json - any tips appreciated.

ResponseEntity<Polydata[]> entity = new ResponseEntity<Polydata[]>(array, headers, HttpStatus.CREATED);
return entity;

Json format I would like to produce

var shapes = [{
"type": "Feature",
"properties": {"category": "ABC"},
"geometry": {
    "type": "Polygon",
    "coordinates": [[
        [-104.05, 48.99],
        [-97.22,  48.98],
        [-96.58,  45.94],
        [-104.03, 45.94],
        [-104.05, 48.99]
    ]]
}
}, {
"type": "Feature",
"properties": {"category": "DEF"},
"geometry": {
    "type": "Polygon",
    "coordinates": [[
        [-109.05, 41.00],
        [-102.06, 40.99],
        [-102.03, 36.99],
        [-109.04, 36.99],
        [-109.05, 41.00]
    ]]
}
}];
MikeW
  • 4,659
  • 9
  • 39
  • 79

0 Answers0