How Pretty Printing Works
This tool takes your GeoJSON and reformats it with consistent two-space indentation, proper line breaks, and sorted structure. The output is valid JSON that is much easier to read and debug than compact or irregularly formatted data. It uses the standardJSON.stringify(data, null, 2) approach, which is the same formatting most IDEs and linters apply to JSON files.
Pretty printing does not modify your data in any way — coordinates, properties, and structure remain identical. Only whitespace characters are added or normalized. This makes the tool safe to use on production data without risking unintended changes.
When to Pretty Print GeoJSON
- Reading and understanding the structure of minified API responses
- Preparing GeoJSON for inclusion in documentation or blog posts
- Debugging geometry issues by inspecting coordinate arrays visually
- Comparing two versions of a file in a diff tool
- Making GeoJSON human-readable before committing to version control
- Reviewing exported data from GIS tools like QGIS or ArcGIS that output compact JSON
Pretty Print vs. Minify
Pretty printing and minification are opposite operations. Pretty printing adds whitespace for readability, while minification removes it for smaller file sizes. Use pretty printing during development and debugging, and minification for production payloads where bandwidth matters.
A typical GeoJSON file grows by 40-60% when pretty-printed compared to its minified version. For a 1 MB minified file, the pretty-printed version would be roughly 1.4-1.6 MB. This size increase comes entirely from spaces and newlines and compresses well with gzip, so the difference in transfer size is minimal when served with HTTP compression.
Try It
Paste a minified GeoJSON object like the one below into the input panel. The tool immediately reformats it with proper indentation:
Minified GeoJSON{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"name":"Central Park"},"geometry":{"type":"Polygon","coordinates":[[[-73.981,40.768],[-73.958,40.800],[-73.949,40.797],[-73.973,40.764],[-73.981,40.768]]]}}]}The output will show each key on its own line with nested objects and arrays clearly indented. Coordinate arrays are especially easier to read — you can quickly spot swapped lat/lng values or missing ring closures that would be invisible in a single long line.
Programmatic Equivalent
In JavaScript or Node.js, pretty printing is a single call to JSON.stringifywith an indentation argument:
JavaScriptconst formatted = JSON.stringify(geojson, null, 2);In Python, use the json module with indent:
Pythonimport json
formatted = json.dumps(geojson, indent=2)The command-line tool jq also pretty-prints by default: jq '.' input.geojson. For more on working with GeoJSON programmatically, see the Python guide and JavaScript guide.