← All guides

    How to Pretty-Print or Minify JSON in Your Browser

    November 2026 · 8 min read · By Macrae Myint

    JSON is easy to produce and awkward to read. An API response or a config file often arrives as one long line, and the file you ship to production should usually go back to that compact form. The ToolsForge File Converter can pretty-print a JSON file with two-space indentation, or minify it, entirely in your browser. It also has a couple of text clean-up options that are easy to confuse with a real data conversion, so this guide is explicit about what the tool will and will not do.

    Pretty-print versus minify

    Pretty-printing parses the file and writes it back out with line breaks and two-space indents, which is the same default JSON.stringify(value, null, 2) uses in JavaScript. Minifying parses it and writes it back with no extra whitespace. The data does not change — keys, values, and types stay as they were — only the packing changes.

    Because the file is parsed first, invalid JSON is rejected with an error instead of being half-rewritten. A missing comma, a trailing comma that a looser parser might allow, or a file that is actually JavaScript (unquoted keys, comments) will fail. That is useful: it is better to see the error on your machine than to find out after you have uploaded a broken config. If you need to strip comments or convert a JavaScript-style object literal, do that in your editor first, then run the converter on real JSON.

    Key order is preserved as it appeared in the file, which is how JavaScript's JSON parser behaves. Numbers, booleans, null, arrays, and nested objects all come through. The tool is not a schema validator: it will happily pretty-print JSON that is syntactically valid and semantically wrong for your app.

    How to format a JSON file

    1. Open the File Converter and drop in a .json file (or a file whose type is application/json).
    2. Choose Pretty JSON if you want to read or review it, or Minified JSON if you want the compact form for production.
    3. Click Convert and download the result. The downloaded file keeps the original name. Processing stays in this tab; the contents are not sent to a server.

    A minified object such as {"name":"ToolsForge","tools":10,"free":true} becomes a multi-line, indented document under Pretty JSON, and shrinks back to the same compact string under Minified JSON. The character counts change; the values do not.

    What this tool does not do

    It does not convert JSON to CSV, or CSV to JSON. There is no mapping of objects to rows, no choice of delimiter, and no handling of nested arrays. If you need that, use a spreadsheet, a script, or a dedicated data tool. The File Converter's other text options are much simpler, and they are easy to over-read:

    • A .csv file can be saved as plain text. That is just the same characters in a .txt file, not a parsed table.
    • A generic text file can be saved as CSV (one per line), which keeps non-empty lines and drops blank ones. It does not split columns, quote fields, or turn a list of objects into a table.
    • The same text file can be saved as TXT (cleaned), which collapses every run of whitespace — spaces, tabs, and line breaks — into a single space and trims the ends. That is the right fix for a paragraph copied from a PDF or a web page with chaotic spacing. It is the wrong fix for poetry, code, or anything whose line breaks carry meaning. Once those breaks are gone, they are gone.

    Image conversions (JPG, PNG, WebP, BMP) live in the same tool but are a different path; see converting image formats for that. If you need to change the letter case of keys or labels, copy the text into the Text Case Converter — and remember that identifier styles such as snake_case drop non-ASCII letters, so check the output before using it as a key.

    Awkward files

    A UTF-8 byte order mark at the start of a file can make a parse fail even when the rest is valid JSON. If you see an error on a file that looks fine in your editor, check for a BOM or for two JSON values in a row. This converter expects one JSON value (usually an object or an array) in one file. JSON Lines — one value per line, common in logs — is not a single JSON document and will not parse. Split the lines or wrap them in an array first. Very large files are limited by your device's memory, because the whole document is read and parsed in this tab; a multi-hundred-megabyte dump may need a command-line tool instead.

    Privacy, and files that contain secrets

    API dumps and config files often include tokens, session cookies, internal hostnames, or personal data. Because the converter runs locally, those values are not uploaded as part of the conversion. That is a better default than a website that asks you to paste a document into a text box on a server. It does not make the file safe. The copy you download, email, or commit is still a copy of the secrets. Strip them before you share the pretty-printed file, and do not treat "it never left my browser" as a reason to paste a production secret into a ticket.

    Related: File Converter, Text Case Converter.

    Format JSON locally

    Pretty-print or minify in your browser. Invalid JSON is reported, not silently rewritten.

    Open File Converter →