DevelopmentRuns locally

JSON Formatter and Validator

Format, validate or minify JSON without sending it to a server. Paste your data, choose an indentation style and copy or download the result.

New to JSON? Read the step-by-step beginner guide

01

Paste and process JSON

Use any valid JSON value, from a complete object to a single boolean or number.

Waiting for JSON
02

Input

0 characters0 bytes

Standard JSON uses double-quoted keys and strings, with no comments or trailing commas.

03Process

Applied when formatting. Minified output has no indentation.

04

Output

0 characters0 bytes

Copy the latest result or save it as a local .json file.

Step-by-step beginner guide

Make one JSON example readable, then repair it

This JSON contains useful data, but the compact version hides its structure. You will validate it, format it, make one deliberate mistake, and use the error to repair it. Terminology comes after the first visible result.

Learning path: compact → valid → formatted → broken → repaired → ready to copy

Back to the JSON Formatter
Beginner guide contents
See the change first

JSON in one minute

The two examples below hold the same ordinary parsed values. The first is compact. The second adds line breaks and two-space indentation so the structure is easier to follow.

Before — compact JSON

{"site":"Foxger","private":true,"tools":["Slug Generator","JSON Formatter","UTM Campaign URL Builder","Hreflang Generator and Validator"],"available":4,"notes":null}

The data fits on one line, but the list boundary is easy to miss.

After — formatted with 2 spaces

{
  "site": "Foxger",
  "private": true,
  "tools": [
    "Slug Generator",
    "JSON Formatter",
    "UTM Campaign URL Builder",
    "Hreflang Generator and Validator"
  ],
  "available": 4,
  "notes": null
}

The indentation shows which values belong to the object and which belong to the list.

JSON is a text format for structured data. Braces can hold named properties; square brackets can hold a list. Formatting adds layout whitespace for people to read. It does not add a new property or intentionally change the parsed values in this example.

Name what you can already see

See the basic parts of JSON

The Foxger example includes every basic kind of value you need for the first pass.

Object
The outer { ... } groups named properties.
Property
"site": "Foxger" joins one key to one value.
Key
"site" is a key. JSON object keys use double quotes.
String
"Foxger" is text, so it is enclosed by double quotes.
Boolean
true is a boolean. It is lowercase and has no quotes.
Array
"tools" holds an ordered list inside [ ].
Number
4 is a number. Quoting it would instead make it the string "4".
Null
null deliberately represents no value. It is lowercase and unquoted.

A colon separates each key from its value. A comma separates one property or array item from the next. The final item does not receive a trailing comma.

Ask one narrow question

Validate the example

Paste the compact example into JSON input, then select Validate JSON. Foxger passes the complete text to the browser’s native JSON.parse method.

Valid JSON

The browser accepted the input as JSON syntax.

That success is useful but limited. It does not prove that available has the right number, that an API allows a notes property, or that any required field is present. Those are data or schema questions, not JSON syntax questions.

Make nesting visible

Format the example

Leave Indentation on 2 spaces, its Foxger default, and select Format JSON. The browser parses the input and recreates it withJSON.stringify.

Each nested line moves to the right. The four tool names sit farther right than thetools property because they belong inside its array.

2 spaces

"tools": [
  "Slug Generator",
  "JSON Formatter"

Foxger’s default. Compact and commonly readable.

4 spaces

"tools": [
    "Slug Generator",
    "JSON Formatter"

More horizontal separation. It represents the same nesting.

Tabs

"tools": [
⇥"Slug Generator",
⇥"JSON Formatter"

The arrows are teaching marks. The real output contains tab characters.

JSON does not require one of these three indentation styles. Choose the style your project expects or the one you find easiest to review. Changing the selector alone does nothing to the current output; select Format JSON again to apply it.

Create a compact result

Minify the same JSON

Select Minify JSON. Foxger parses the example and recreates it without optional indentation or line-break whitespace:

{"site":"Foxger","private":true,"tools":["Slug Generator","JSON Formatter","UTM Campaign URL Builder","Hreflang Generator and Validator"],"available":4,"notes":null}

Minified JSON is harder for people to scan, but it is useful when compact text is preferred. It does not remove spaces inside a quoted string. For example, the space inside"JSON Formatter" remains part of that value.

Smaller text is not automatically a meaningful performance improvement in every application. Use minification because your destination expects or benefits from compact JSON, not as a universal requirement.

Mistake → location → repair

Make one mistake deliberately

Add a comma after null, immediately before the closing brace. That comma promises another property, but the object ends instead.

Incorrect — trailing comma

{
  "site": "Foxger",
  "private": true,
  "tools": [
    "Slug Generator",
    "JSON Formatter",
    "UTM Campaign URL Builder",
    "Hreflang Generator and Validator"
  ],
  "available": 4,
  "notes": null,
}

The extra comma follows the final property.

Correct — final comma removed

{
  "site": "Foxger",
  "private": true,
  "tools": [
    "Slug Generator",
    "JSON Formatter",
    "UTM Campaign URL Builder",
    "Hreflang Generator and Validator"
  ],
  "available": 4,
  "notes": null
}

The closing brace now follows the final value directly.

Select Validate JSON. Foxger shows Invalid JSON, associates the error with the input, and includes a one-based line and column when it can extract a location from the browser’s message.

Browser wording can differ. The location may point at the closing brace where parsing stopped rather than at the comma where the mistake began. Use it as a starting point, inspect the preceding token, remove the comma, and validate again.

One complete workflow

Validate, format, break, and repair the example

Each step has one action, one reason, and one visible result to check.

  1. Put the compact example in the input

    Action: Copy the one-line Foxger example from the guide into JSON input.

    Reason: Its data is correct, but its structure is difficult to scan while everything sits on one line.

    Check: The counters update and the status changes to “Not validated”. No output appears yet.

  2. Validate before changing it

    Action: Select Validate JSON.

    Reason: Validation answers the first question: can the browser parse this text as JSON?

    Check: The status reads “Valid JSON”. Validation alone does not create a new output.

  3. Read what success does and does not mean

    Action: Notice the green success status before moving on.

    Reason: It confirms JSON syntax, not whether an API expects these keys or whether the data is sensible.

    Check: You can explain why “valid” is narrower than “correct for my application”.

  4. Format with the default

    Action: Leave Indentation on 2 spaces and select Format JSON.

    Reason: Line breaks and two-space indents expose the object, property, and array structure.

    Check: The output matches the formatted guide example and the status reads “Valid JSON — formatted”.

  5. Compare another indentation style

    Action: Choose 4 spaces or Tabs, then select Format JSON again.

    Reason: Changing the selector does not rewrite an existing result until Format JSON runs.

    Check: Only layout whitespace changes; the parsed values remain the same for this example.

  6. Introduce one trailing comma

    Action: Add a comma after the final null value, just before the closing brace, and select Validate JSON.

    Reason: JSON does not allow a comma after the last property.

    Check: The output is cleared after the edit, the input becomes invalid, and the error identifies a nearby line and column when the browser supplies one.

  7. Use the location as a starting point

    Action: Go to the reported line, then inspect the token immediately before it.

    Reason: A parser often stops at the closing brace even though the extra comma just before it caused the problem.

    Check: You find the comma after null instead of changing the valid closing brace.

  8. Repair and validate again

    Action: Remove the trailing comma and select Validate JSON.

    Reason: One small repair should return the source to valid syntax without changing its intended data.

    Check: The error disappears, aria-invalid returns to false, and the status reads “Valid JSON”.

  9. Create the result you actually need

    Action: Select Format JSON for readable output or Minify JSON for compact output, then copy or download it.

    Reason: Copy and Download always use the latest generated output, not merely the validated input.

    Check: A formatted download is foxger-formatted.json; a minified download is foxger-minified.json.

Name the jobs after using them

Formatter versus validator versus minifier

The three actions begin by parsing the same input, but they answer different questions.

Validator

Question: Is the JSON syntax valid?

Result: A success status or parser feedback. It does not create new output.

Formatter

Question: How does this valid JSON look with readable indentation?

Result: A new string using 2 spaces, 4 spaces, or tabs.

Minifier

Question: How does this valid JSON look without optional layout whitespace?

Result: A compact new string.

Other workspace actions

Load example
Places the guide’s two-space Foxger example in the input and immediately formats the output with the currently selected indentation.
Copy output
Writes the latest formatted or minified result to the clipboard. It does not copy input that was only validated.
Download JSON
Downloads the latest result as foxger-formatted.json or foxger-minified.json, according to the operation that created it.
Clear
Empties both textareas, resets their counts and status, removes any error, and returns focus to JSON input.
Requirement → result → correction

Common JSON mistakes worth recognising

These are syntax problems Foxger can detect. Each correction uses the smallest useful example.

Using single quotes

Incorrect

{'site': 'Foxger'}

Result: The browser rejects the text because JSON strings and property names require double quotes.

Correct

{"site": "Foxger"}

Leaving a key unquoted

Incorrect

{site: "Foxger"}

Result: That can resemble a JavaScript object, but it is not valid JSON.

Correct

{"site": "Foxger"}

Leaving a trailing comma

Incorrect

{"site": "Foxger",}

Result: The parser reaches the closing brace while still expecting another property.

Correct

{"site": "Foxger"}

Forgetting a comma

Incorrect

{"site": "Foxger" "private": true}

Result: Separate object properties need a comma between them.

Correct

{"site": "Foxger", "private": true}

Closing with the wrong symbol

Incorrect

{"tools": ["JSON Formatter"}]

Result: The final square bracket cannot close the object opened by a brace.

Correct

{"tools": ["JSON Formatter"]}

Adding a comment

Incorrect

{"private": true /* local */}

Result: Standard JSON has no comment syntax, even though JavaScript does.

Correct

{"private": true}

Using undefined or NaN

Incorrect

{"notes": undefined, "count": NaN}

Result: undefined and NaN are JavaScript values, not JSON values. Choose a real JSON value that matches the data.

Correct

{"notes": null, "count": 0}

Putting a function in the data

Incorrect

{"format": function () {}}

Result: JSON represents data. It does not contain executable functions.

Correct

{"format": "json"}
Similar shape, different rules

JSON is not a JavaScript object literal

These two examples can describe similar data, but only the first is JSON.

JSON

{
  "name": "Foxger"
}

The property key and string value both use double quotes.

JavaScript object literal

{
  name: "Foxger"
}

JavaScript allows this unquoted key. JSON does not.

JavaScript also has comments, undefined, NaN, functions, and other syntax that JSON cannot represent. If JavaScript accepts a value, that alone does not make its source text valid JSON.

An object is common, not required

JSON can begin with an array or primitive value

Foxger accepts every top-level value that the native JSON parser accepts. A complete JSON text does not have to begin with {.

true42"hello"null["one", "two"]

Formatting a top-level primitive such as true produces truebecause there is no nested structure to indent. Whether your destination accepts a primitive is a separate application rule.

Use the parser’s stopping point

Read an error line and column

Line
The one-based line where the browser reported or reached the problem.
Column
The one-based position within that line.
Reason
The browser’s explanation, cleaned so Foxger does not repeat an excerpt of your JSON in the error.

Foxger extracts a raw parser position when the browser provides one and converts it to line and column. Some browsers already report line and column; some messages provide no usable location. In that fallback case, Foxger still says the JSON is invalid and shows the cleaned reason without inventing coordinates.

The visible error does not include a separate nearby-text snippet. Look at the input itself, start at the reported location, and inspect backward. Missing commas and quotes often make the parser complain only when it reaches the next otherwise-correct token.

Two measurements, two questions

Character and UTF-8 byte counts

The input and output each show a character count and byte count. Foxger counts Unicode code points as characters and measures the text after UTF-8 encoding as bytes.

Café 🦊
Characters
6
UTF-8 bytes
10

ASCII characters usually use one UTF-8 byte. The accented é and fox emoji use more, which is why the totals differ. A combined visible symbol can also contain more than one code point, so this “character” total is a documented technical count rather than a promise about every symbol a person sees.

What happens to the text

Privacy and local processing

Parsing, formatting, minifying, counting, copying, and download preparation run through JavaScript in your browser. Foxger does not intentionally upload the JSON to a formatting API or save it in server storage.

  • The workspace has no form submission and does not put JSON in the page URL.
  • Tool input is not written to local storage, session storage, IndexedDB, or cookies.
  • The unrelated theme preference may be stored locally if you choose Light, Dark, or System.
  • Copy writes only the current output to your device clipboard after you select Copy.
  • Download creates a temporary local Blob URL with the MIME type application/json;charset=utf-8.
  • Input and output remain textarea text; markup-like JSON is not rendered as page HTML.

Loading Foxger still makes an ordinary page request that hosting and security systems may log. The JSON itself is not added to that request by this tool. See thePrivacy page for the site-wide distinction.

Know the browser limits

Very large JSON and exact source text

Foxger does not advertise or enforce a fixed input-size limit. That is not the same as unlimited capacity. Parsing a large document and creating another full string can use substantial browser memory and make the page slow or temporarily unresponsive.

Extreme nesting has another limit: JSON can be syntactically valid but too deeply nested for the browser to serialize. Foxger keeps the input, clears unavailable output, and reportsValid JSON — output unavailable instead of pretending the syntax is invalid.

When exact source text matters

Format and Minify parse first and stringify afterward. That preserves the ordinary parsed meaning of this guide’s example, but it is not a byte-for-byte source editor.

  • Duplicate object keys resolve to the last parsed value.
  • Numbers beyond JavaScript’s safe integer precision can be rounded during parsing.
  • Number spelling and escape sequences can be normalized in the new string.
  • Foxger does not alphabetize keys; browser property-order rules still apply.

Keep the original when exact spelling, duplicate keys, numeric precision, or source order matters.

Start with what you can see

Troubleshooting the JSON Formatter

Foxger says my JSON is invalid

Start at the reported line and column when one is shown. Check the preceding token for a missing comma, trailing comma, single quote, unquoted key, comment, or unmatched brace. Empty and whitespace-only input are invalid too.

The error points near the wrong-looking place

The location is where the browser parser stopped, not always where the mistake began. Inspect the character at that location and then work backward to the previous comma, quote, bracket, or brace.

My JSON works in JavaScript but fails here

A JavaScript object literal may use unquoted keys, single-quoted strings, comments, undefined, NaN, or functions. JSON accepts none of those forms. Convert the value to JSON syntax rather than pasting JavaScript source unchanged.

The output is empty

Validate JSON reports syntax status but does not generate output. Editing the input also clears stale output. Select Format JSON or Minify JSON after the input is valid. Very deeply nested valid JSON can validate but still be too deep for the browser to serialize.

Formatting changed the whitespace

That is the formatter’s job. It recreates layout whitespace with the selected indentation. Meaningful spaces inside quoted strings remain part of the string, but outside formatting whitespace changes.

My key order did not change

Foxger is not a key sorter. It parses the data and uses the browser’s JSON.stringify behavior; it does not alphabetize object properties. Integer-like property names can still follow JavaScript’s property-order rules.

My JSON is valid but my API still rejects it

Syntax validation cannot check an API’s schema, required fields, allowed values, authentication, or business rules. Compare the formatted data with that API’s own documentation or schema.

The page slows down with a huge JSON document

Foxger enforces no fixed input-size limit. Parsing and creating another complete output string can use substantial memory or keep the main browser tab busy. Try a smaller section or use a streaming or command-line tool for very large files.

Copy does not work

Clipboard access requires a supported secure browser context and a direct action. If it fails, Foxger focuses and selects the output so you can use your browser or operating system’s ordinary copy command.

My downloaded file has formatting I did not expect

Download uses the latest generated output. Changing Indentation does not regenerate it by itself, and Validate does not replace it. Select Format JSON or Minify JSON immediately before downloading the version you want.

Words used in this guide

Compact JSON glossary

JSON
A text syntax for representing structured data with objects, arrays, strings, numbers, booleans, and null.
Object
A group of named properties enclosed by braces: { and }.
Property
One key and its value inside an object.
Key
The double-quoted name on the left side of an object property.
Value
The data on the right side of a property, or an item inside an array.
String
Text enclosed by double quotes.
Number
A numeric JSON value written without quotes.
Boolean
One of the two JSON values true or false.
Null
The JSON value null, used to represent no value intentionally.
Array
An ordered list of values enclosed by square brackets: [ and ].
Syntax
The rules that determine whether JSON text is structurally valid.
Validator
A check that asks whether the input follows JSON syntax.
Formatter
A transformation that recreates valid JSON with readable indentation.
Minifier
A transformation that recreates valid JSON without unnecessary layout whitespace.
Indentation
Spaces or tabs at the start of a line that make nesting visible.
Parse
Read JSON text and turn it into a value the browser can work with.
Byte
A unit of encoded data. Foxger measures the JSON text as UTF-8 bytes.
Find two familiar mistakes

Practice: repair a smaller Foxger object

Paste this example into the tool and select Validate JSON:

{
  "site": "Foxger",
  private: true,
  "available": 4,
}

Find the unquoted key and the comma after the final property. Repair both, validate again, then format with 2 spaces. Open the solution only after you have a valid result.

Show the verified solution
{
  "site": "Foxger",
  "private": true,
  "available": 4
}

"private" now uses the required double quotes, and4 is followed directly by the closing brace because it is the final property.

Before using the result

Final checklist

  • My JSON validates successfully.
  • I understand that formatting changes layout and may normalize source representation.
  • I chose and applied the indentation I want.
  • I repaired errors before copying or downloading.
  • I know JSON keys and strings use double quotes.
  • I know valid JSON does not guarantee correct application data.
  • I reviewed the size and sensitivity of the data before pasting it into any website.
Back to the JSON Formatter
Quick answers

JSON Formatter questions

What is JSON?

JSON is a text syntax for representing structured data with objects, arrays, strings, numbers, booleans, and null. It is used to exchange and store data, but valid syntax alone does not define what the data means.

Does formatting change JSON values?

For ordinary JSON, formatting changes layout whitespace rather than the parsed values. Foxger parses and then stringifies the input, however, so duplicate keys, very large numbers, number spelling, escape spelling, and some property ordering can be normalized. Keep the original when exact source text matters.

Is my JSON uploaded to Foxger?

No. Validation, formatting, minification, counting, copying, and download preparation run locally in your browser. Foxger does not intentionally upload or store the JSON, place it in the page URL, or submit it through a form.

Why does JSON require double quotes?

The JSON syntax requires property names and string values to use double quotes. Single-quoted strings and unquoted object keys may work in JavaScript source, but they are not valid JSON.

Can JSON contain comments?

No. Standard JSON has no comment syntax. Remove JavaScript-style line or block comments, or store explanatory text as an ordinary JSON property when the receiving format allows it.

Can JSON begin with an array or primitive value?

Yes. Foxger accepts any top-level value supported by the browser JSON parser: an object, array, string, number, boolean, or null. A particular API may impose narrower requirements.

What is the difference between formatting and minifying?

Formatting recreates valid JSON with line breaks and your selected indentation. Minifying recreates it without unnecessary layout whitespace. Both actions parse the input first; validation checks syntax without creating output.

Why does valid JSON still fail in an API?

JSON validity checks syntax only. An API can still reject missing fields, unexpected keys, wrong value types, disallowed values, failed authentication, or other application rules. Check that API’s own documentation or schema.

What do the line and column number mean?

They identify the one-based location where the browser parser reported or reached a problem. The mistake may begin just before that point, and exact parser wording or available location data can differ between browsers.

Can Foxger handle very large JSON files?

Foxger has no fixed input-size limit, but browser memory and main-thread work are practical limits. Large documents can slow or block the page, and extremely deep valid JSON can exceed the browser serializer’s nesting depth.

Primary references

Official JSON references

These sources document the syntax and native browser methods behind the tool. The guide summarizes them in beginner-friendly language.

Optional support

Help keep Foxger useful

Foxger tools are free, private, and built without display ads. Optional support helps keep them maintained, tested, and documented.

Support Foxger