View formatted JSON - Microsoft Edge Developer documentation (2024)

  • Article

Use the JSON viewer to automatically format and syntax highlight JSON responses and files in browser tabs.

The JSON viewer changes the returned JSON data to make it easier to read. Sometimes a web server responds to HTTP requests by returning data encoded as JSON. JSON data can be difficult to read when it's formatted as a single long, concatenated line of text. The same can occur when opening a JSON file from disk.

The JSON viewer improves readability of JSON data in several ways:

  • The JSON syntax is highlighted with different colors.
  • Object properties are displayed on their own lines and indented.
  • Objects can be collapsed or expanded.
  • The JSON viewer matches your operating system's dark or light theme.

Supported scenarios

The JSON viewer is not supported in windows that are opened by using the window.open JavaScript method. In windows opened with window.open, JSON data is displayed as a single line of text, without formatting or syntax highlighting.

View reformatted JSON server responses

To view a JSON response from a web server as reformatted JSON:

  1. Open a new tab or window in Microsoft Edge.

  2. Type a URL that returns JSON data in the address bar. For example, use this sample JSON response: https://microsoftedge.github.io/Demos/json-dummy-data/256KB-min.json.

    You can find more samples of JSON responses at MicrosoftEdge / Demos > json-dummy-data.

  3. Microsoft Edge detects that the returned data is JSON and formats it automatically:

    View formatted JSON - Microsoft Edge Developer documentation (1)

View reformatted JSON files

To view a JSON file stored on your device as reformatted JSON:

  1. Open a new tab or window in Microsoft Edge.

  2. Press Ctrl+O on Windows and Linux, or Command+O on macOS, and then select a JSON file.

  3. Microsoft Edge detects that the file contains JSON data and formats it automatically:

    View formatted JSON - Microsoft Edge Developer documentation (2)

Detect invalid JSON data

JSON data can sometimes be invalid. For example, the following patterns are invalid in JSON:

  • Omitting double quotes around a key name.
  • Having a trailing comma after the last key/value pair.

The JSON viewer applies syntax highlighting to invalid JSON. However, the JSON viewer doesn't format the content, and you can't collapse or expand objects.

You can find information about the invalid syntax in the Console tool, where the JSON viewer reports errors.

To view invalid JSON data:

  1. Open a new tab or window in Microsoft Edge.

  2. In the Address bar, go to a URL that returns invalid JSON data. For example, use this sample invalid JSON response: https://microsoftedge.github.io/Demos/json-dummy-data/missing-colon.json.

    You can find other invalid samples of JSON responses at MicrosoftEdge / Demos > json-dummy-data.

  3. Microsoft Edge detects that the file contains invalid JSON data, and colorizes the JSON listing, but doesn't wrap or otherwise reformat the JSON listing. The fact that the JSON isn't wrapped indicates there's malformed JSON.

  4. Open the Console tool by pressing Ctrl+Shift+J (Windows, Linux) or Command+Option+J (macOS).

    A JavaScript error indicates where the JSON syntax error is located:

    View formatted JSON - Microsoft Edge Developer documentation (3)

  5. In a code editor, such as Microsoft Visual Studio Code, go to the indicated column number to inspect the JSON:

    View formatted JSON - Microsoft Edge Developer documentation (4)

Search the JSON data

To search for text within the JSON data, use the JSON viewer's Find feature, as follows:

  1. View a JSON response or file in the JSON viewer.

  2. Click anywhere in the formatted JSON data, to put focus in the JSON data.

  3. Press Ctrl+F (Windows, Linux) or Command+F (macOS). The search toolbar appears at the top of the JSON viewer:

    View formatted JSON - Microsoft Edge Developer documentation (5)

  4. In the Find text box, start typing the text you want to search for. As you type, the JSON viewer highlights all of the occurrences of the text string in the JSON data.

To stop the search, click the Cancel button in the JSON viewer's toolbar.

Move through the search results

To move to the next or previous search result, after results were found, click the Next or Previous buttons in the search toolbar. The currently selected search result is highlighted in a different color:

View formatted JSON - Microsoft Edge Developer documentation (6)

Modify the type of search

The search toolbar contains Match Case, Regexp, and By Word checkboxes, to modify the type of search:

View formatted JSON - Microsoft Edge Developer documentation (7)

Perform a case-sensitive search

By default, the search is case-insensitive. For example, a search on hello matches Hello, HELLO, hello, or any string that contains the characters hello with any casing.

To make the search case-sensitive, select the Match Case checkbox in the search toolbar.

Search by a regular expression

By default, the search string is treated as a literal string.

To search by using a regular expression, select the Regexp checkbox in the search toolbar.

Search by whole word only

By default, the search is not restricted to finding just the whole, isolated word surrounded by spaces. For example, a search on hello matches hello, hello-world, and world-hello, or any string that contains the sequence of characters hello.

To restrict the search to match only the string surrounded by spaces, without adjacent letters, select the By Word checkbox in the search toolbar.

View formatted JSON - Microsoft Edge Developer documentation (2024)

FAQs

View formatted JSON - Microsoft Edge Developer documentation? ›

Right-click on the page, select “Inspect,” and go to the “Network” tab. Reload the page. Look for the request that returned JSON data, click on it, and view the JSON content in the “Response” tab.

How do I view JSON in Microsoft edge? ›

Right-click on the page, select “Inspect,” and go to the “Network” tab. Reload the page. Look for the request that returned JSON data, click on it, and view the JSON content in the “Response” tab.

How do you display JSON data in readable format? ›

Format JSON is the same as beautify JSON : you make your JSON file readable by styling it with white spacing, newlines, and indentation. In short: paste your JSON file, then click the "Format" button in code mode, or select "Copy formatted" from the menu. This is how you make your JSON pretty.

How to view a JSON file properly? ›

Opening JSON files is far more straightforward than you might think; it is a very simple data structure that is entirely text-based — which is why it is limited to strings and numbers. Because of this, you can use any file opener to view a JSON file, such as notepads, text editors, and even command-line interfaces.

How to convert JSON into readable format? ›

You can convert JSON to TXT with MConverter in three easy steps:
  1. Choose JSON files from your device. At the top of this page, drag and drop your JSONs. ...
  2. Click or tap on TXT from the list of target formats. ...
  3. Download your TXT files, after MConverter has finished processing them.

How to access JSON data from response? ›

Getting a specific property from a JSON response object

Instead, you select the exact property you want and pull that out through dot notation. The dot ( . ) after response (the name of the JSON payload, as defined arbitrarily in the jQuery AJAX function) is how you access the values you want from the JSON object.

How to view data in JSON format in browser? ›

To view a JSON response from a web server as reformatted JSON: Open a new tab or window in Microsoft Edge. Type a URL that returns JSON data in the address bar. For example, use this sample JSON response: https://microsoftedge.github.io/Demos/json-dummy-data/256KB-min.json.

How to check JSON data format? ›

Proper JSON Format

Strings: All strings must be wrapped in double quotes (" "). Single quotes (' ') are not valid. Data Types: JSON supports several types including strings, numbers, booleans (true or false), arrays, and objects ({}).

How to open a JSON file in a browser? ›

Steps to open JSON files on Web browser (Chrome, Mozilla)
  1. Open the Web store on your web browser using the apps option menu or directly using this link.
  2. Here, type JSON View in search bar under the Extensions category.
  3. You will get the various extensions similar to JSON View to open the JSON format files.

How do I open a JSON file in proper format? ›

Opening a JSON File

For Windows, you can use Microsoft Notepad or Visual Studio Code. Mac users can opt for Apple TextEdit or Mac Vim, while Linux users might prefer the Vim editor or PICO. Web Browsers: Both Google Chrome and Mozilla Firefox can display JSON files.

How to get the data in JSON format? ›

JSON.parse()

A common use of JSON is to exchange data to/from a web server. When receiving data from a web server, the data is always a string. Parse the data with JSON.parse() , and the data becomes a JavaScript object.

How to format a JSON file to be readable? ›

With the plugin installed, open the JSON file you want to format in Notepad++. Go to the Plugins menu and select the JSON Viewer option. This will open a new window that displays the JSON code with proper indentation and color-coded syntax highlighting to make it easier to read and edit.

What is the best way to read a JSON file? ›

JSON Introduction

Assuming a Windows operating system, right-click the . json file and select Open With, then select Notepad, WordPad, or any other text editor that you have installed.

Is JSON format human readable? ›

JSON is a file format that uses human-readable language to store and communicate data objects. JSON (JavaScript Object Notation) is defined as a file format used in object-oriented programming that uses human-readable language, text, and syntax to store and communicate data objects between applications.

How to pull information from JSON? ›

To extract JSON data from a column and put it in separate columns:
  1. Go to the column in the workbook. ...
  2. Use the column's menu to select Extract columns. ...
  3. In the modal, select the fields you want to pull out into their own columns.
  4. Click Confirm. ...
  5. Use the new columns in your explorations and analysis.

How do I view JSON responses in Chrome? ›

Answer. Google Developer Tools will be displayed at the bottom of the browser. Locate the JSON on the left column and select the "Response" tab. Copy and paste the JSON into a text document for further review.

How to parse a JSON response? ›

JavaScript Demo: JSON.parse()
  1. const obj = JSON. parse(json);
  2. console. log(obj. count);
  3. console. log(obj. result);
Mar 17, 2024

How do I open a JSON file in my browser? ›

Steps to open JSON files on Web browser (Chrome, Mozilla)
  1. Open the Web store on your web browser using the apps option menu or directly using this link.
  2. Here, type JSON View in search bar under the Extensions category.
  3. You will get the various extensions similar to JSON View to open the JSON format files.

How do I read JSON files on Windows? ›

JSON Introduction

Assuming a Windows operating system, right-click the . json file and select Open With, then select Notepad, WordPad, or any other text editor that you have installed. If you leave the option “Always use this app to open . json files” checked, then you will be able to just double-click the .

How to access JSON content? ›

To access the JSON object in JavaScript, parse it with JSON. parse() , and access it via “.” or “[]”.

How to access data in JSON file? ›

Follow these steps to read the JSON file using the fetch API method:
  1. Create a JSON file and add data to it.
  2. Open the JavaScript file.
  3. In the fetch method pass the path of the JSON file.
  4. Use the . json() method to parse the data in JSON format.
  5. Display the content in the console.
6 days ago

Top Articles
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 5551

Rating: 4.7 / 5 (47 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.