---
title: JSON Viewer, Formatter, and Validator | Prettify Docs
description: Open, validate, and format JSON in Prettify. See how it detects
  JSON, accepts comments, keeps large numbers exact, and reports errors.
url: https://prettify.tools/docs/json
---

[Docs](https://prettify.tools/docs) / Formats

# JSON

Last updated: October 16, 2026

Prettify opens, validates, formats, and transforms JSON in your browser. Your data stays on your device. This page explains how Prettify reads JSON, which views it gets, how it reports errors, and how it keeps large numbers exact.

Open the editor at [/app/editor](https://prettify.tools/app/editor), or start from the [JSON Viewer](https://prettify.tools/json-viewer) or [JSON Formatter](https://prettify.tools/json-formatter) tool pages.

## How Prettify detects JSON

Prettify reads a `.json`, `.jsonc`, or `.geojson` file as JSON. When you paste text, Prettify tries a JSON parse first. Text that parses as one JSON value opens as JSON.

A leading `//` or `/*` comment also opens as JSON, because Prettify accepts comments (see below). You can also set the format by hand in the sidebar or the Command Palette.

Line-delimited JSON (one value per line) opens as [JSONL](https://prettify.tools/docs/jsonl), shown as JSON with a JSON Lines badge.

## Views

JSON gets four views. Tree, Raw, and Table are free. Diagram (Pro) draws the data as a node graph.

| View          | What it shows                                              |
| ------------- | ---------------------------------------------------------- |
| Tree          | A collapsible tree of keys and values. The default view.   |
| Raw           | The formatted text, with line numbers and inline problems. |
| Table         | Arrays of objects as rows and columns.                     |
| Diagram (Pro) | A node graph with collapsible nodes.                       |

To switch views, use the view tabs or the Command Palette. Open the Command Palette with `Cmd+K` (Mac) / `Ctrl+K` (Windows, Linux). See [Views](https://prettify.tools/docs/views) and [Diagram view](https://prettify.tools/docs/diagram-view).

### Value previews in the tree

The Tree view adds small hints to some values: a readable date for timestamps, a swatch for colors, a link for URLs, and a decode button for base64 text. Two more help with API and log data:

- **JWTs.** A key icon follows a JSON Web Token. Select it to see the header, the payload, and the `iat`, `nbf`, and `exp` times as dates, with an `Expired` or `Not expired` label. The token is decoded on your device and is not sent anywhere. The signature is not checked.
- **JSON inside a string.** A JSON icon follows a string that holds a JSON object or array. Select it to see the parsed value, then select `Replace with parsed value` to put the object in the document, or `Open in new tab` to open it as its own document.

To turn the hints off, go to Settings, then Editor, then `Smart value previews`.

## Validation and error messages

Prettify checks JSON as you type and lists every problem in the Problems panel. Each problem carries a line and column, so you can jump to it.

A duplicate object key is kept as valid JSON, because `JSON.parse` keeps the last value. Prettify adds a warning that names the key and both values, for example:

```text
Duplicate key "id": value 1 was overwritten by 2. Remove one to fix.
```

A parse error names the first problem in plain language. When the text looks like several JSON documents, the message points you to JSON Lines.

### Repair on paste

When you paste broken JSON, the paste dialog shows the first error and a Fix all button. Fix all repairs these problems:

- Trailing commas
- Single-quoted strings
- Curly or smart quotes
- Unquoted property names
- Missing commas

When the paste looks like JSON Lines, the dialog offers Parse as JSON Lines instead. See [Troubleshooting](https://prettify.tools/docs/troubleshooting).

## JSON with comments (JSONC)

Prettify accepts JSONC, the relaxed JSON that configuration files use. A strict parse runs first. Only when it fails does Prettify try the relaxations, so valid JSON is never changed.

These relaxations are accepted:

```jsonc
{
  // line comments and /* block comments */
  "trailingComma": 1,
  'singleQuotes': true,
}
```

Prettify adds an information note when it reads your input as JSONC, for example: "Comments were ignored. The input was read as JSONC, not strict JSON." Unquoted keys and missing commas are not accepted as JSONC; they report an error, which Fix all can repair.

## Large and precise numbers

Prettify keeps numbers byte for byte. A plain `JSON.parse` corrupts numbers outside the safe range: Snowflake IDs, database bigints, high-precision decimals, and trailing-zero floats like `4.0`. Prettify preserves the exact digits through view, select, copy, and round-trip.

```json
{
  "id": 7205759403792793600,
  "price": 4.0,
  "ratio": 0.1000000000000000055511151231257827
}
```

The policy is simple. Viewing, selecting, copying, and round-trip keep the value exactly. Computing on a value coerces it, which can lose precision. For example, a [jq](https://prettify.tools/docs/jq) pass-through like `.id` keeps the exact number, but arithmetic coerces it. Conversion to YAML, CSV, or XML also coerces, and Prettify warns you.

## Format, convert, and query

Prettify pretty-prints JSON with two-space indentation. Copy Formatted copies that text. Download saves it. Sort Keys reorders object keys A to Z.

Convert turns JSON into [JSONL](https://prettify.tools/docs/jsonl), YAML, CSV, or XML. See [Conversion](https://prettify.tools/docs/conversion). Generate Types turns a sample into TypeScript and other type definitions; see [Type generation](https://prettify.tools/docs/type-generation).

These transforms are Pro:

- jq (Pro) filters and reshapes JSON. See [jq queries](https://prettify.tools/docs/jq).
- JSON Schema (Pro) validates against a schema. See [JSON Schema](https://prettify.tools/docs/json-schema).
- Diff / Compare (Pro) compares two documents. See [Diff](https://prettify.tools/docs/diff).

Pro is a one-time purchase of US$19.99 with lifetime access and a 30-day money-back guarantee. See [Pro](https://prettify.tools/docs/pro). You can try each Pro feature once per day for free.

## Limits and privacy

Parsing, editing, and queries run on your device. Prettify does not upload your JSON unless you create a share link. A free share link holds the document in a compressed URL up to about 32 KB. A Pro short link holds documents up to 10 MB. See [Sharing](https://prettify.tools/docs/sharing) and [Privacy](https://prettify.tools/docs/privacy).

## Try it online

Tool pages for this topic. Each one runs in your browser.

- [JSON Formatter](https://prettify.tools/json-formatter)
- [JSON Viewer](https://prettify.tools/json-viewer)
- [JSON Validator](https://prettify.tools/json-validator)
- [JSON Editor](https://prettify.tools/json-editor)
- [Minify JSON](https://prettify.tools/minify-json)
- [JSON Escape](https://prettify.tools/json-escape)
- [JSON Unescape](https://prettify.tools/json-unescape)
- [JWT Decoder](https://prettify.tools/jwt-decoder)

* [PreviousGetting started](https://prettify.tools/docs/getting-started)
* [Next JSONL and NDJSON](https://prettify.tools/docs/jsonl)

## Structured data

```json
{
  "@context": "https://schema.org",
  "@type": "SoftwareApplication",
  "name": "Prettify",
  "url": "https://prettify.tools",
  "description": "Multi-format data viewer, editor, and query engine for JSON, YAML, CSV, XML, Mermaid, Markdown, MDX, HTML, and SVG",
  "applicationCategory": "DeveloperApplication",
  "operatingSystem": "Web, macOS, Windows, Linux",
  "offers": [
    {
      "@type": "Offer",
      "price": "0",
      "priceCurrency": "USD",
      "description": "Free tier with core features"
    },
    {
      "@type": "Offer",
      "price": "19.99",
      "priceCurrency": "USD",
      "description": "Pro: lifetime access to all features"
    }
  ],
  "publisher": {
    "@id": "https://prettify.tools/#organization"
  }
}
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "@id": "https://prettify.tools/#organization",
  "name": "Prettify",
  "legalName": "Off Leash Labs",
  "url": "https://prettify.tools/",
  "logo": {
    "@type": "ImageObject",
    "url": "https://prettify.tools/icon-512.png",
    "width": 512,
    "height": 512
  },
  "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "customer support",
    "email": "offleashlabs@gmail.com",
    "availableLanguage": "English"
  }
}
```
