# JSON formatter > How can you format and check JSON? Paste JSON to find errors, tidy it up or make it compact. Format, validate and minify JSON in your browser. Find errors by line and column, sort keys, choose indentation, then copy or download JSON. - Page: https://how.box/json/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/json/?mode={mode}&indent={indent}&sort={sort} - `mode` (pretty or minify): pretty or minify. Example: `pretty`. - `indent` (2, 4 or tab): 2 or 4 spaces, or tab. Example: `2`. - `sort` (boolean): Sort object keys recursively. Example: `false`. Example answer: https://how.box/json/?mode=pretty&indent=2&sort=0 The page computes the answer in the browser: read results from the agent tools below, not from the page HTML. ## Agent tools - `json_format`: Validate and format JSON locally. - MCP: POST https://how.box/mcp `tools/call` with `{"name":"json_format","arguments":{…}}`; input schema in https://how.box/agent-tools.json. ## How it works JSON represents objects, arrays, strings, numbers, true, false and null. Object names and strings use double quotes. A trailing comma or a comment is not part of JSON. This checker follows the JSON grammar in RFC 8259 and reports the first error with a line and column, both counted from one. Pretty printing adds line breaks and indentation; minifying removes unnecessary whitespace. For example, [1, 2] becomes [1,2] when minified. Spaces inside a string remain part of its value. Sorting rearranges object keys recursively while keeping array order; keys that are integer indices appear first in numeric order. The tool accepts up to 20,000 source characters and formats up to 32 nesting levels. Duplicate names keep the last value. Decimal numbers may round to standard floating-point precision, while numbers outside the supported range and unsafe integers are refused for output. Text stays in the browser and is never put in a link. ## FAQ **Why is my JSON invalid?** Common causes are single quotes, unquoted names, comments and trailing commas. The reported position is where the problem was detected; a missing quote or bracket may be earlier. **Does formatting preserve every character?** No. Whitespace, escapes and number notation may change. Duplicate keys keep only the last value, and decimal precision is limited. Use quoted strings for identifiers or exact decimal amounts that must not change. **Why does valid JSON sometimes produce no output?** Validation checks syntax separately from formatting limits. Deeply nested data, non-finite parsed numbers and integers outside the safe range can be syntactically valid but are not formatted. **Can a JSON document be just a number or a string?** Yes. A JSON value can be an object, array, string, number, true, false or null. **Does sorting keys also sort arrays?** No. Sorting changes object keys recursively; array elements keep their order. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)