How GeoJSON Validation Works
This validator checks your GeoJSON against the RFC 7946 specification. It verifies the structural integrity of your data including required fields, coordinate formats, geometry types, and nesting rules. Paste your data and any errors are reported immediately with specific descriptions of what went wrong and where.
Validation runs entirely in your browser. Your GeoJSON data is never sent to a server. The validator also counts features by geometry type, giving you a quick overview of what your data contains alongside the validation result.
What Gets Validated
Reported as errors: the data will not behave:
- Type field: must be a valid GeoJSON type (Feature, FeatureCollection, Point, etc.)
- Coordinates: must be finite numbers, with at least a longitude and a latitude per position
- Coordinate ranges: longitude within -180 to 180, latitude within -90 to 90
- Polygon rings: must be closed (first and last position identical) with at least four positions
- LineStrings: must have at least two positions
- Geometry objects: must include a valid
typeandcoordinatesmember - Feature objects: must include a
geometrymember, which may benull - FeatureCollection: must include a
featuresarray whose members are all Features - bbox: when present, must be four numbers (or six with elevation)
Reported as warnings: these render correctly everywhere, but deviate from the specification:
- Winding order: RFC 7946 states the right-hand rule as a SHOULD: exterior rings counterclockwise, holes clockwise
- Missing
properties: the specification requires the member on every Feature, even when it isnull
What it does not check is geometric validity: self-intersecting rings, overlapping polygons and topology errors all pass. It also cannot catch every swapped coordinate pair. Swapping New York's [-73.99, 40.75] gives [40.75, -73.99], a perfectly legal position in the South Atlantic. The swap is only detectable when the latitude lands outside -90 to 90, which is why it surfaces for data west of 90°W or east of 90°E and not elsewhere. To correct winding order, apply turf.rewind(), ST_ForcePolygonCCW in PostGIS, or Shapely's orient().
Common GeoJSON Errors
The most frequent mistakes developers encounter with GeoJSON include:
- Swapped coordinates: GeoJSON uses [lng, lat], not [lat, lng]. This is the single most common error, causing points to appear in the ocean or on the wrong continent. Reverse every pair with
turf.flip(). - Unclosed polygon rings: the last coordinate must exactly match the first coordinate. A ring with 4 unique vertices needs 5 positions.
- Missing properties: Feature objects must include a
propertiesmember, even if it isnullor an empty object. - Bare geometries: using a raw Geometry object where a Feature or FeatureCollection is expected by the consuming library.
- Invalid JSON syntax: trailing commas, unquoted keys, or single quotes instead of double quotes:
JSON (invalid, trailing comma) (excerpt){
"type": "Feature",
"properties": { "name": "Test" },
"geometry": {
"type": "Point",
"coordinates": [40.7484, -73.9857], ← trailing comma
}
}Validation in Your Workflow
Validate GeoJSON at system boundaries: when receiving data from external APIs, after format conversions, and before importing into databases. Catching errors early prevents silent failures downstream, a PostGIS import with invalid geometry may succeed but produce wrong query results later.
For programmatic validation, most languages have GeoJSON validation libraries. In JavaScript, geojson-validation and Turf.js provide structural checks. In Python, geojson and shapely can validate both structure and geometry. See the debugging guide for a systematic approach to fixing common GeoJSON problems.
After Validation
Once your GeoJSON passes validation, you can view it on a map, stringify it with JSON.stringify(geojson, null, 2) for readability, or with JSON.stringify(geojson) (no indent) for production use. If your polygon winding order is wrong, turf.rewind() can fix it automatically. For a full list of available tools, return to the homepage.