Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple JSON encoder #15

Merged
merged 3 commits into from
Dec 14, 2023
Merged

Add simple JSON encoder #15

merged 3 commits into from
Dec 14, 2023

Conversation

groldan
Copy link
Member

@groldan groldan commented Dec 12, 2023

Make application/json output format serve simple JSON instead of GeoJSON.

        {
            "numberMatched":16,
            "numberReturned":2,
            "records":[
                {
                    "@id":"1",
                    "city":" Trento",
                    "number":140,
                    "year":2002
                },
                {
                    "@id":"10",
                    "city":" Barcelona",
                    "number":914,
                    "year":2010
                }
             ],
             "links":[
                 {
                     "href":"http://localhost:8080/ogcapi/collections/locations/items?f=json&offset=0&limit=2",
                     "rel":"self",
                     "type":"application/json",
                     "title":"This document"
                 },
                 {
                     "href":"http://localhost:8080/ogcapi/collections/locations/items?f=json&offset=2&limit=2",
                     "rel":"next",
                     "type":"application/json",
                     "title":"Next page"
                 },
                 {
                     "href":"http://localhost:8080/ogcapi/collections/locations/items?offset=0&limit=2&f=geojson",
                     "rel":"alternate",
                     "type":"application/geo+json",
                     "title":"This document as GeoJSON"
                 },
                 {
                     "href":"http://localhost:8080/ogcapi/collections/locations/items?offset=0&limit=2&f=shapefile",
                     "rel":"alternate",
                     "type":"application/x-shapefile",
                     "title":"This document as Esri Shapefile"
                 },
                 {
                     "href":"http://localhost:8080/ogcapi/collections/locations/items?offset=0&limit=2&f=csv",
                     "rel":"alternate",
                     "type":"text/csv;charset=UTF-8",
                     "title":"This document as Comma Separated Values"
                 },
                 {
                     "href":"http://localhost:8080/ogcapi/collections/locations/items?offset=0&limit=2&f=ooxml",
                     "rel":"alternate",
                     "type":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                     "title":"This document as Excel 2007 / OOXML"
                 }
             ]
        }
    

@groldan groldan added the enhancement New feature or request label Dec 12, 2023
Make `application/json` output format serve simple JSON instead of
GeoJSON.

```json
    {
        "numberMatched":16,
        "numberReturned":2,
        "records":[
            {
                "@id":"1",
                "city":" Trento",
                "number":140,
                "year":2002
            },
            {
                "@id":"10",
                "city":" Barcelona",
                "number":914,
                "year":2010
            }
         ],
         "links":[
             {
                 "href":"http://localhost:8080/ogcapi/collections/locations/items?f=json&offset=0&limit=2",
                 "rel":"self",
                 "type":"application/json",
                 "title":"This document"
             },
             {
                 "href":"http://localhost:8080/ogcapi/collections/locations/items?f=json&offset=2&limit=2",
                 "rel":"next",
                 "type":"application/json",
                 "title":"Next page"
             },
             {
                 "href":"http://localhost:8080/ogcapi/collections/locations/items?offset=0&limit=2&f=geojson",
                 "rel":"alternate",
                 "type":"application/geo+json",
                 "title":"This document as GeoJSON"
             },
             {
                 "href":"http://localhost:8080/ogcapi/collections/locations/items?offset=0&limit=2&f=shapefile",
                 "rel":"alternate",
                 "type":"application/x-shapefile",
                 "title":"This document as Esri Shapefile"
             },
             {
                 "href":"http://localhost:8080/ogcapi/collections/locations/items?offset=0&limit=2&f=csv",
                 "rel":"alternate",
                 "type":"text/csv;charset=UTF-8",
                 "title":"This document as Comma Separated Values"
             },
             {
                 "href":"http://localhost:8080/ogcapi/collections/locations/items?offset=0&limit=2&f=ooxml",
                 "rel":"alternate",
                 "type":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                 "title":"This document as Excel 2007 / OOXML"
             }
         ]
    }

```
@groldan groldan merged commit b84ee79 into main Dec 14, 2023
1 check passed
@groldan groldan deleted the feature/simple_json branch December 14, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants