How to Format a JSON File on Android (Pretty-Print)
You have a .json file or a block of JSON text, and it is unreadable - everything is
crammed onto one line, or the spacing is inconsistent and the nesting is impossible to follow. What
you want is formatted JSON: proper indentation, one value per line, and a clear structure.
This guide explains what formatting does and how to pretty-print JSON on an Android phone.
Short version: open the JSON in a viewer that pretty-prints automatically. It adds the indentation and line breaks for you and lays the data out as a tree you can read at a glance.
What "formatting" JSON actually means
JSON stores data as objects (in curly braces), arrays (in square brackets), and values. The same data can be written two ways. Minified, to save space:
{"user":{"name":"Alex","active":true,"roles":["admin","editor"]}}
Or formatted (also called pretty-printed or beautified), with indentation and line breaks:
{
"user": {
"name": "Alex",
"active": true,
"roles": ["admin", "editor"]
}
}
Both are exactly the same data - formatting changes nothing about the content. It only adds whitespace so a human can read the structure. That is why "format", "pretty-print" and "beautify" all describe the same operation.
Why JSON so often arrives unformatted
APIs, exports and backups usually send minified JSON on purpose, because removing whitespace makes the file smaller and faster to transfer. That is fine for machines, but it means the file you open on your phone is a wall of text. A basic text preview or note app will show it exactly as stored - unformatted - and leave you to make sense of it yourself.
How to format a JSON file on Android, step by step
1. Install a JSON viewer
Install JSON Viewer from Google Play. It is free and needs no account.
2. Load your JSON
Open the app and tap Open JSON File to pick your file with the Android document picker - from device storage, Downloads, or another app such as mail or cloud storage. If your JSON is not saved as a file, you can also paste it from the clipboard or load it from a URL.
3. Read the formatted result
The JSON is pretty printed automatically. It opens in a structured tree view with indentation and syntax highlighting for keys, values, objects and arrays. Expand and collapse nodes to move through it, and long-press a node to inspect its keys, values and path more closely.
Formatting JSON that isn't saved as a file
Often the JSON you want to read starts life somewhere other than a saved file - a response in a browser, a string copied from a chat, or a value from a developer tool. The home screen accepts a few input methods for exactly this:
- Paste the JSON from your clipboard.
- Load it from a URL that returns JSON.
- Scan a QR code that contains JSON or a link to it.
Whichever way it comes in, it is formatted and laid out the same way as a file.
Tips once it is formatted
Formatting is usually just the first step. Once the structure is readable, you can search inside the content to jump to a key or value, and bookmark nodes you want to return to in a large document. A dark mode is available for comfortable reading. If you need to keep the tidied-up version, saving, sharing and exporting the formatted JSON are available in Pro.
The app behind this guide
JSON Viewer is my own Android app, and it is what the steps above describe. It pretty prints and formats JSON automatically, lays it out in a clean tree view you can expand and collapse, searches inside the content, holds up with large files, and has a dark mode. The core viewer is free and needs no account.
An optional Pro unlock adds very large file support, JSONPath search, copying node paths, saved bookmarks, and saving, sharing or exporting the formatted result.
