Command line JSON

I finally found out about json.tool while debugging responses from the Pleiades spatial index server. It pretty-prints and validates.

$ curl "http://pleiades.stoa.org/places/442733/json" | python -mjson.tool
{
    "bbox": [
        15.005568999999999,
        40.422631000000003,
        15.005568999999999,
        40.422631000000003
    ],
    "features": [
        {
            "geometry": {
                "bbox": [
                    15.005568999999999,
                    40.422631000000003,
                    15.005568999999999,
                    40.422631000000003
                ],
                "coordinates": [
                    15.005568999999999,
                    40.422631000000003
                ],
                "type": "Point"
            },
            "id": "darmc-location-18805",
            "properties": {
                "description": "",
                "link": "http://pleiades.stoa.org/places/442733/darmc-location-18805",
                "title": "DARMC location 18805"
            },
            "type": "Feature"
        }
    ],
    "id": "442733",
    "type": "FeatureCollection"
}

Would it be worth adding such a tool to the geojson module?

Comments

Re: Command line JSON

Author: Seth G

It would be great to have a geojson validator (command line or web) along the lines of http://www.jsonlint.com/

I'm never sure if CRS (or SRS?) is required - GDAL seems to crash if it is missing. It would be nice to have a tool to check if there are missing coordinate values etc. (although loading with Shapely helpw with the latter).

Re: Command line JSON

Author: Sunng

python's json module can be considered as a formatting tool.

Recently I find a command line query tool for json called jshon, which is of great helpful.

http://kmkeen.com/jshon/index.html

Re: Command line JSON

Author: Howard Butler

Seth G,

File a bug on GDAL if its GeoJSON module is crashing in cases with or without SRS info. It shouldn't be required, and if it is crashing, it needs to be fixed.

Howard