JSON formatter
Pretty-print JSON with your choice of indentation, optionally sorting keys.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/json-format \
-H 'Content-Type: application/json' \
-d '{"input":{"text":"{\"b\":1,\"a\":[1,2]}"}}'
import json, urllib.request
body = {'input': {'text': '{"b":1,"a":[1,2]}'}}
request = urllib.request.Request("https://setget.net/v1/tools/json-format", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/json-format", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"text":"{\"b\":1,\"a\":[1,2]}"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "json-format",
"input": {
"text": "{\"b\":1,\"a\":[1,2]}"
}
}
{
"input": {
"text": "{\"b\":1,\"a\":[1,2]}"
}
}
Endpoint: POST /v1/tools/json-format. Over MCP: run_tool with slug: "json-format".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
text |
string | yes | The JSON to format. |
indent |
integer | no | Spaces per indentation level. Default: 2. From 1 to 8. |
sort_keys |
boolean | no | Sort object keys alphabetically. Default: false. |
Examples
Input
{
"text": "{\"b\":1,\"a\":[1,2]}"
}Result
{
"text": "{\n \"b\": 1,\n \"a\": [\n 1,\n 2\n ]\n}"
}Sorted keys, four spaces
Input
{
"text": "{\"b\":1,\"a\":2}",
"sort_keys": true,
"indent": 4
}Result
{
"text": "{\n \"a\": 2,\n \"b\": 1\n}"
}Questions
- Does formatting change my data?
- No. Only whitespace changes, and key order if you ask for sorting.
- What happens if the JSON is broken?
- You get the line and column of the first fault, so you can fix it.
Related tools
- JSON minifierRemove all optional whitespace from JSON to make it as small as possible.
json-minify - JSON validatorCheck whether text is valid JSON and get the exact line and column of the first error.
json-validate - JSON diffCompare two JSON documents and get the differences as a JSON Patch (RFC 6902).
json-diff - .env to JSONParse a .env file into a JSON object, handling quotes, comments and "export" prefixes.
env-to-json - CSV profilerSummarise each CSV column: type, blanks, distinct values, min, max, mean and top values.
csv-profile - CSV sort, filter and dedupeSort CSV by a column, keep rows containing some text, pick columns and remove duplicate rows.
csv-sort-filter-dedupe