JSON formatter
Try JSON Formatter
Loading calculator. If this message stays visible, enable JavaScript and reload.
Your result
The JSON formatter turns pasted JSON into an indented view with two spaces per nesting level. Use it when a compact API response or configuration object is difficult to inspect on one line. Paste the JSON itself, choose Calculate / Run, and read the formatted result below the form.
MoneyOr parses the input and writes the resulting value back as JSON. That method makes objects and arrays easier to follow, but it is not a character-for-character layout change. Duplicate object names can collapse, large numbers can lose precision, and some equivalent number or string representations can change. Keep the original when exact data matters. The worked examples show both the readable output and the cases where you should stop before replacing a source file.
Formatting JSON for review
When does an indented view from the JSON formatter help?
The JSON formatter adds indentation so you can follow the structure of a value. In a compact response, an array of order items can sit beside an account object and several flags without an obvious visual boundary. Formatting gives each nested level more space, so it is easier to see which property belongs to which object and where an array ends.
That is useful while comparing an API response with its documentation, checking a small configuration change or explaining a data sample to a colleague. A readable layout reduces the effort of locating a field. It does not decide whether the field is correct. A well-formatted response can still contain an unexpected status, an empty list or the wrong account identifier.
Start with a copy rather than your only source. Preserve the original response body and its context, such as which endpoint and test input produced it. Formatting alone cannot recover that information later. For confidential production data, use an appropriate private development environment and a sanitised sample when discussing the issue. An ordinary online example rarely needs real access tokens, personal addresses or payment details.
How do I format a pasted JSON response?
Copy the complete JSON value and replace the demonstration input in the JSON input field. Include its opening and closing delimiters. Choose Calculate / Run. If parsing and serialisation succeed, the result displays a readable JSON string. Review the beginning, middle and end rather than assuming that an attractive layout means every value is as expected.
Paste the data body, not a surrounding log label or HTTP response heading. A line such as Response: {"ok":true} contains text before the JSON value. The object alone can be parsed; the labelled line is not a JSON document. Similarly, Markdown code fences are presentation markers. Remove them before supplying a JSON value to this form.
After correcting an input, run it again. The form is action-based; it does not format every keystroke automatically. Keep edits small while investigating an error so you can see which change affected the result. If a large sample fails, first verify a short known-valid value. Very large or deeply nested inputs can encounter browser processing limits even when their data format is otherwise valid.
How does the JSON formatter choose its layout?
The implementation uses the browser's JSON parser, then serialises the parsed value with a two-space indentation setting. Objects display named members, arrays display their entries, and deeper structures receive further indentation. The form has no indentation selector, tab option or collapsible tree view. What you receive is formatted text that you can inspect and copy.
JSON supports objects, arrays, strings, numbers, booleans and null. A complete value does not have to start with an object. For example, [3,1,2] becomes an array written over several lines, while the scalar 42 remains 42. The formatter does not add an object wrapper or a new property around either input.
The parser and writer are separate stages. Parsing interprets the input as values, and writing chooses a JSON representation for those values. The result can therefore differ from the original spelling even when the general meaning is unchanged. MDN Web Docs explains the serialisation operation in its JSON.stringify() reference. This tool uses the fixed layout described here rather than exposing every option of that programming method.
Pay attention to types while reading an indented view. The boolean false and the string "false" are different values. The number 42 and the string "42" also differ, even though a casual glance may miss the quotation marks. Empty containers have meaning too: [] is an array and {} is an object. Formatting preserves these distinctions for ordinary inputs; it does not convert them to whatever type your application expects. When a field is rejected downstream, inspect its type as well as its spelling.
What does a complete formatting example look like?
Consider a small order record with one line item and a payment flag. The compact input is:
{"order":"A17","items":[{"sku":"pen","qty":2}],"paid":false} The result is:
{
"order": "A17",
"items": [
{
"sku": "pen",
"qty": 2
}
],
"paid": false
} The indentation shows that sku and qty belong to the object inside items. The paid flag belongs to the outer order object. Formatting has not multiplied the quantity, calculated a price or confirmed payment. The example only changes the displayed representation of this data.
| Value to inspect | Expected type | What to check |
|---|---|---|
| order | String | The identifier is A17, including its letter. |
| items | Array | It contains one object in this sample. |
| qty | Number | The quantity is 2 rather than the text "2". |
| paid | Boolean | The value is false, without quotation marks. |
Change one detail at a time when reproducing a problem. If your application expects several items, add a second complete item object and check the separating comma. If it expects a string quantity, compare the sample with the endpoint's own contract before changing the type. The formatter shows the structure; the application documentation defines what the structure should be.
Why can formatting change a number or remove a repeated name?
A parsed value does not retain every detail of its source text. Enter {"tag":"first","tag":"last"} and the formatted output contains the last tag value. The earlier member is no longer visible in the resulting object. If duplicate names might matter to your investigation, inspect the original first. Reformatting is not a duplicate-name audit.
Numbers deserve the same caution. The input {"id":9007199254740993} becomes a value with 9007199254740992 in this implementation. That is a real data change, not extra whitespace. JavaScript's ordinary number type cannot represent every large integer exactly. MDN documents its exact-integer boundary in Number.MAX_SAFE_INTEGER. Use a representation and tool appropriate to exact identifiers before rewriting such a record.
Other changes can preserve the numeric value while changing its spelling. In the checked input {"amount":1e3,"zero":-0,"letter":"\u0041"}, the output uses 1000, 0 and "A". Array entry order remains meaningful, but object-name order should not be used as a guarantee of source preservation. Keep the original for signatures, byte comparisons or any workflow that depends on the exact input string.
If an identifier is already a quoted string in the original JSON, it stays a string through this formatter and its digit sequence is not interpreted as an ordinary number. That can be useful for long account-like identifiers, but the receiving contract decides the correct type. Do not change an endpoint's required number to a string merely to make the output look stable. Choose an exact-data workflow for that contract and verify the resulting request with the system that consumes it. The warning is about preserving meaning, not a universal rule that every large value should be quoted.
How should I investigate a formatting error?
Read the error, then inspect the surrounding punctuation in the original input. Common causes include single quotes around a name, an extra comma after the last member, an unfinished string or a missing closing bracket. Fix the intended data rather than applying a global text replacement that could alter valid content inside strings.
| Input problem | Small example | What to review |
|---|---|---|
| Single-quoted name | {'a':1} | JSON names require double quotes. |
| Trailing comma | {"a":1,} | Remove the comma after the final member. |
| Unquoted text value | {"name":Ada} | Use a JSON string for the name. |
| Missing closing delimiter | [1,2 | Complete the array if that matches the source. |
If a known-valid value copied from a file still fails at its first position, inspect the copy for a byte-order mark or surrounding non-JSON text. A file encoding marker is not a property of the JSON value. Keep the original file while you investigate rather than deleting arbitrary characters until the error disappears.
The exact error wording comes from the browser and can vary. A reported position is a starting point, not always the place where you first made the mistake. An earlier missing quote may make a later comma appear unexpected. If you copied only part of a response, retrieve the complete data instead of inventing a plausible ending.
This form does not repair JSON automatically. The separate JSON validator is useful when you want a syntax result without producing reformatted data. Neither tool checks a schema or confirms a server's required fields. Use a known-good sample and the actual API or configuration specification for that next layer of review.
What should I check after the JSON looks readable?
Look for differences that affect your application: a number supplied as text, a missing member, null where an object is expected, or an empty array where at least one item is required. JSON syntax permits many values that a particular application rejects. A date-looking string also remains a string; the formatter does not decide whether it is a real date or convert it to a date object.
Use the original alongside the result when precision or provenance matters. Compare suspicious large identifiers, repeated member names and escaped content before saving over a file. For a test report, keep a sanitised original and the formatted view under distinct filenames. That makes it possible for another person to reproduce the transformation and see the source representation.
Valid JSON is not a security approval. A string can contain HTML or other text that would need safe handling if an application later renders it. This operation parses data rather than executing JavaScript, but it cannot guarantee how downstream code uses the result. Do not treat formatting as sanitisation, access control or proof that a payload is safe to trust.
How can I reuse the result without confusing its format?
Copy result copies the formatted output when clipboard access is available. Paste it into your editor and save it there if you need a JSON file. Download CSV is a report export containing the result in a CSV field, not a dedicated JSON-file download. Renaming that report with a JSON extension would not turn its surrounding CSV rows into a valid JSON document.
Use the JSON minifier when a compact representation is the next task. If a payload is genuinely Base64-encoded or URL-component-encoded, the Base64 decoder or URL decoder may be a separate earlier step. Decode only the encoding actually present; several unrelated formats can look like escaped text.
Save as baseline keeps a temporary result comparison, and Reset fields restores the form's initial values. Neither is document version control. Keep source files in your own storage. The operation runs in the browser, while other website data practices are covered by the MoneyOr privacy policy. Avoid using real credentials in public debugging samples.
JSON formatting questions
Can I choose four spaces or tabs?
The current form uses two spaces for each nesting level and has no layout selector. Use the result when that layout suits your review, or apply your project's formatting convention in its editor. Changing indentation alone should not require changing the intended data, but preserve the original before using any parser-based formatter.
Will it alphabetically sort object names?
No alphabetical sorting option is provided. The output follows JavaScript's serialisation behaviour after parsing, and some property ordering can differ from the original text. If sorted names are a project requirement, use a process that explicitly implements that rule. Do not assume an indented result is sorted merely because it looks orderly.
Can I paste a JavaScript object literal?
Only if it is also valid JSON. JavaScript expressions can contain functions, undefined values, comments or unquoted property names that JSON does not accept. Supply a JSON representation of the intended data. A variable declaration or an executable expression is not a JSON value, even if an object appears inside it.
Does the formatter support JSON Lines?
It expects one complete JSON value. Several separate objects on successive lines are not one JSON document. If your source uses JSON Lines, process records with a tool designed for that format or deliberately convert the records into a valid array where appropriate. Keep the original record boundaries if they matter to the receiving system.
Will escaped newlines become extra JSON members?
No. An escaped newline inside a string remains string content. For example, a note containing line\nbreak does not create a new property when formatted. An actual unescaped newline inside a quoted JSON string is a syntax problem. Distinguish the string's escaped content from whitespace placed between members.
Can I open JSON from a URL or upload a file here?
This form accepts pasted JSON text. It does not fetch a remote address or provide a file uploader. Open a file in your own editor and copy the relevant data if appropriate. Entering a URL by itself does not load its response. The URL parser can inspect an address's components, which is a different task.
References and verification
- IETF, RFC 8259: The JavaScript Object Notation Data Interchange Format, retrieved 14 November 2026.
- MDN Web Docs, JSON.stringify(), retrieved 14 November 2026.
- MDN Web Docs, Number.MAX_SAFE_INTEGER, retrieved 14 November 2026.
Examples were run against the current MoneyOr browser engine. Preserve exact source data when parser normalisation could affect the task.