JSON Formatter API - Pretty-Print with Custom Indent
Takes a compact or poorly formatted JSON string and returns it with consistent indentation and line breaks. Configure the indent size (2 or 4 spaces are common) to match your project style.
Code examples
curl -X POST https://api.botoi.com/v1/json/format \
-H "Content-Type: application/json" \
-d '{"json":"{\"name\":\"botoi\",\"version\":2}","indent":2}'When to use this API
Format API responses for logging
Pretty-print API response bodies before writing them to log files so developers can scan them during debugging.
Build a config file viewer
Display formatted JSON config files in an admin dashboard so non-technical users can read and review settings.
Standardize indentation in CI pipelines
Run this endpoint in a CI step to verify that all checked-in JSON files follow a consistent 2-space or 4-space indent rule.
Frequently asked questions
What indentation levels are supported?
Any positive integer works, though 2 and 4 are the most common. The default is 2 spaces.
Does formatting change the data in any way?
No. The output is semantically identical to the input. Only whitespace and line breaks change.
What happens if the input JSON is invalid?
The API returns an error with the parse failure location, so you can fix the syntax issue.
Can I format JSON with tab indentation instead of spaces?
The API currently supports space-based indentation only. Set the indent parameter to your preferred number of spaces.
Get your API key
Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.