How do I view JSON in Chrome?

Dark navy cover card with the title 'How do I view JSON in Chrome?' in white and a green accent bar

To view JSON in Chrome, open the JSON URL in a tab and tick the Pretty-print checkbox at the top of the page. For JSON that a web page fetched in the background, open DevTools, pick the request in the Network panel and read the Response tab. If you need a collapsible tree with folding, paste the JSON into a viewer or use an extension.

Open the JSON URL and use Pretty-print

Chrome shows a JSON document as text with a Pretty-print checkbox above it, so a plain tab is now the quickest way to view JSON in Chrome. The checkbox arrived around Chromium version 117. One user noted on the extension support page that in v116 the JSON "would just be rendered", while v117 asked them to click pretty print.

When I opened an API URL in a Chromium-based browser this month, the page showed the raw response with the checkbox at the top-left. Ticking it indents the text. That's all it does: no folding, no search, no way to copy a key's path.

You can switch it off for good. A reply in a Chromium pretty-print thread says the launch argument --disable-blink-features=PrettyPrintJSONDocument disables the feature. Try it if an older JSON extension broke after the change.

View API responses in the DevTools Network panel

The DevTools Network panel is where you view JSON that a page requested behind the scenes, such as a fetch to /api/orders. Per the Network features reference, you select the request and open the Response tab to see its body.

The steps:

  1. Press F12 (or right-click the page and choose Inspect) and open Network.
  2. Filter by Fetch/XHR and reload the page if the list is empty.
  3. Click the request, then open Response.
  4. To take the body elsewhere, right-click the request and choose Copy > Copy response.

The reference describes the Preview tab as mostly useful for images, so trust Response. Minified body? Copy response and paste it into a formatter.

Inspect JSON in the DevTools Console

The DevTools Console can turn JSON text into an object you can expand. Paste the text into JSON.parse, which, per the JSON.parse reference, returns the matching object or array and throws a SyntaxError if the text isn't valid JSON.

const data = JSON.parse(`{"user":{"id":7,"roles":["admin","dev"]}}`);
data

The Console prints data as an object you click open one level at a time. Going the other way, the Console utilities include copy(object), which copies a string version of an object to your clipboard. copy(data.user) is a fast way to pull one branch out of a large response.

A SyntaxError here usually means the text isn't plain JSON. The guide to unexpected token at position 0 covers the usual causes, such as an HTML error page where you expected JSON.

Open a local JSON file in Chrome

A local JSON file gets the same treatment as a URL: open it in a tab and the Pretty-print view applies. Drag the file onto a tab, or use the browser's open-file shortcut. In Edge, which shares Chromium's engine, the JSON viewer docs give Ctrl+O on Windows and Linux and Command+O on macOS.

Edge's docs also note something that holds for Chrome: Pretty-print changes how the JSON is displayed, not the file.

Plain text gets painful once a file runs to thousands of lines. See how to open a large JSON file, and for general file handling, how to open a JSON file.

Which way to view JSON should you use?

The best way to view JSON in Chrome depends on where the JSON comes from and how deep it goes. Pick the row that matches:

Situation Best option Why
A JSON URL you can open New tab + Pretty-print Nothing to install
A page's background API call DevTools > Network > Response Shows the exact body the page got
You need one nested branch Console: JSON.parse, then copy() Expand and copy a single key
Deep or large JSON Paste into a tree viewer Folding and a clear structure
JSON pages you open every day A viewer extension Formats every JSON tab

JSON viewer extensions: convenient, with a cost

A JSON viewer extension formats every JSON tab automatically, usually as a collapsible tree with syntax colours.

My take: skip the extension unless you open JSON tabs every day. To format JSON wherever it appears, an extension needs access to the pages you visit, including internal dashboards and API responses that carry tokens. Pretty-print and DevTools cover most needs without handing that over.

If you do install one, check whether it wants a separate "file URL" permission for local files. Disable older formatters too, or two of them will fight over the same page.

Use a JSON viewer tab instead of an extension

A browser-based tree viewer gives you folding without installing anything. OnlineViewer's JSON viewer shows pasted JSON as a collapsible tree. The tool code runs in the page and makes no network requests, and pasted input isn't saved. If you're deciding whether any online formatter is safe for sensitive data, is an online JSON formatter safe walks through what to check.

The limitation: you copy the JSON over by hand, every time. That's fine for a response you check once. For a page you reload all day, an extension or the DevTools Response tab is faster.

FAQ

Does Chrome have a built-in JSON viewer?

Partly. Since around Chrome 117, a page that returns JSON shows a Pretty-print checkbox that indents the text. It does not give you a collapsible tree, search or path copying.

How do I see the JSON an API call returned in Chrome?

Open DevTools, go to the Network panel, click the request and open the Response tab. To take the body elsewhere, right-click the request and use Copy response.

How do I open a local JSON file in Chrome?

Open the file in a tab, by dragging it in or with the open-file shortcut, and the same Pretty-print view applies. For large or deeply nested files, paste the contents into a tree viewer instead.

How do I turn off pretty-print for JSON in Chrome?

Clear the checkbox on the page. To disable the feature entirely, a Chromium user reported that launching the browser with --disable-blink-features=PrettyPrintJSONDocument removes it.

Sources