# JSON formatter

Pretty-print JSON with your choice of indentation, optionally sorting keys.

- Endpoint: `POST https://setget.net/v1/tools/json-format` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `json-format`
- Page: https://setget.net/tools/json-format

## Inputs

- `text` (required, string): The JSON to format.
- `indent` (optional, integer, default `2`, range 1..8): Spaces per indentation level.
- `sort_keys` (optional, boolean, default `false`): Sort object keys alphabetically.

## Example 1

```json
{"input":{"text":"{\"b\":1,\"a\":[1,2]}"}}
```

Result:

```json
{"text":"{\n  \"b\": 1,\n  \"a\": [\n    1,\n    2\n  ]\n}"}
```

## Example 2: Sorted keys, four spaces

```json
{"input":{"text":"{\"b\":1,\"a\":2}","sort_keys":true,"indent":4}}
```

Result:

```json
{"text":"{\n    \"a\": 2,\n    \"b\": 1\n}"}
```

**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.
