GeoJSON linters available in geojsonlint

All three functions return the same outputs. If the GeoJSON is valid, they return TRUE. If the GeoJSON is invalid, they return FALSE, plus reason(s) that the GeoJSON is invalid in an attribute named errors as a data.frame. The fields in the data.frame’s are not the same across functions unfortunately, but they can be easily coerced to combine via e.g., plyr::rbind.fill or dplyr::bind_rows or data.table::rbindlist(fill = TRUE)

The parameters for the three functions are similar, though geojson_validate() has an extra parameter greedy that’s not available in the others, and geojson_hint() has ... parameter to pass on curl options as it works with a web service.

Installation

from CRAN

install.packages("geojsonlint")

Dev version

remotes::install_github("ropensci/geojsonlint")
library("geojsonlint")

Good GeoJSON

geojsonlint.com web service

geojson_lint(x = '{"type": "Point", "coordinates": [-100, 80]}')
#> [1] TRUE

geojsonhint JS library

geojson_hint(x = '{"type": "Point", "coordinates": [-100, 80]}')
#> [1] TRUE

is-my-json-valid JS library

geojson_validate(x = '{"type": "Point", "coordinates": [-100, 80]}')
#> [1] TRUE

Bad GeoJSON

geojsonlint.com web service

geojson_lint('{"type": "FooBar"}')
#> [1] FALSE

geojsonhint JS library

geojson_hint('{"type": "FooBar"}')
#> [1] FALSE

is-my-json-valid JS library

geojson_validate('{ "type": "FeatureCollection" }')
#> [1] FALSE

Bad GeoJSON - with reason for failure

geojsonlint.com web service

geojsonhint JS library

is-my-json-valid JS library

Bad GeoJSON - stop on validation failure

geojsonlint.com web service

geojsonhint JS library

is-my-json-valid JS library

Meta

rofooter