If you are an iOS developer or any kind of engineer who works with APIs, this will sound familiar. You are away from your laptop. Slack pings. A test is failing in CI. The response payload is a 6 KB JSON blob mashed onto one line.
The temptation is to paste it into the first "JSON formatter" Google result on your phone. Do not do that.
Why "just paste it into a website" is a worse idea than it looks
Most JSON-formatter websites are fine. Some are not. The bad ones share patterns:
- Hundreds of trackers on the page. Your payload is paint, the page is a billboard.
- "Free unlimited" formatter sites with no privacy policy, no company name, and a domain registered three months ago.
- Browser extensions that silently exfiltrate everything you paste.
For genuinely public data this is fine. For API responses from work, customer records, anything sensitive - it is the wrong tool. You do not want a customer\'s name and email on a stranger\'s analytics dashboard.
What I do instead
Three options that keep the payload on the phone.
1. TextLab (or any local JSON formatter app)
An app that does JSON formatting locally on the device. Paste the JSON in, hit "Pretty", done. The data never leaves the phone.
Bonus on a phone: a real app has a proper text editor with monospace font and syntax highlighting, where a website usually gives you a tiny text area. The difference shows up the moment your payload has nested arrays.
2. Shortcuts
If you do not want another app installed, the Shortcuts app can do JSON formatting too. The setup:
- Open Shortcuts, create a new shortcut.
- Add a "Get Clipboard" action.
- Add a "Get Dictionary from Input" action.
- Add a "Get Text from Dictionary" action - this serialises it back to pretty JSON.
- Add a "Copy to Clipboard" action.
Save it, give it a short name, and trigger it from the home screen or the action button. Five seconds to format anything on your clipboard.
The downside: Shortcuts\' JSON support is finicky with unusual structures, and there is no syntax highlighting on the output. Fine for a quick check, not great for digging through a complex response.
3. Apple\'s built-in
Did you know NSJSONSerialization is exposed via plutil and defaults, and that those exist on the Mac but not iOS? Right, not useful on a phone. Skip this option, it is here for completeness.
While you are at it
Once you have a JSON formatter on your phone, a few other things become easy:
- Validate JSON: a real formatter highlights syntax errors with line numbers. The "comma at the end of an array" error is the most common one, and a formatter will point right at it.
- Minify for a URL: paste pretty JSON, get a single-line version back, paste it into a curl command or a quick test.
- Compare two responses: in TextLab, pretty-print both, then use the diff action. Useful for "the staging response and the production response should be identical".
- Decode a JWT: JWT is three Base64-URL chunks separated by dots. A JWT decoder action takes the middle chunk and gives you the JSON payload. Helpful for "is this token actually valid?".
The slightly bigger workflow
The above covers "I have JSON on my clipboard". A more powerful pattern is to chain actions in a workflow:
- Clean text (strip leading whitespace, remove BOM).
- Pretty JSON.
- Copy to clipboard.
Save this as a one-tap shortcut. Now any "format JSON" task is one tap from receiving the text. Over a year, this saves real minutes.
I do not usually go this far on a phone, but on Mac I have it bound to a keyboard shortcut and it is one of the most-used actions of my week. The same idea is available on iOS, with one extra tap.
One nerdy aside
If you ever wonder why JSON has " for strings and not ', blame ECMAScript. JSON is officially based on a subset of JavaScript, and JavaScript object literals require double-quoted property names. Most parsers will tell you that { 'foo': 1 } is invalid JSON. If you ever paste something and a formatter rejects it, single quotes are the third-most-common culprit.
The most common are: trailing commas, and missing quotes around property names ({ foo: 1 }). All three are valid JavaScript object literals and invalid JSON.