Developer Basics

How to Format JSON Safely

Learn JSON structure, formatting and validation basics while keeping sensitive data out of logs and online workflows.

Introduction

JSON is a text format for structured data. Formatting adds indentation and line breaks so people can read nested objects and arrays more easily.

Duviho's JSON formatter works locally in the browser, but sensitive production data should still be handled according to your organization's security rules.

Key concept

JSON objects use braces and key-value pairs, while arrays use brackets. Property names and string values require double quotes. Formatting changes whitespace, not the represented data.

Example

The compact text {"name":"Ari","active":true} can be expanded across multiple indented lines. A parser should produce the same object before and after formatting.

Common mistakes

JavaScript-style comments, single-quoted strings, trailing commas and unescaped control characters are not valid standard JSON.

Do not paste secrets, access tokens, personal records or confidential payloads into tools unless you understand where the data is processed.

A simple workflow

Paste the JSON, choose Format and read any validation message. Correct the first reported syntax issue, then validate again because one missing quote or bracket can cause several later errors.