Offline JSON formatter for Mac: Pretty vs Compact
Choose the mode by the output contract. Pretty changes object-key order for readability; Compact preserves input order while removing whitespace.
Use Pretty when you want readable, deterministic object keys. Use Compact when you want to remove insignificant whitespace without reordering the input. Both TeenyTool modes validate a strict JSON object or array, preserve array order, and re-emit the original number-token text.
TeenyTool runs this formatter locally in its Mac menu bar toolbox. It is a good fit for scratch payloads copied from logs, tickets, support tools, or private API responses. It checks syntax, not schemas or API contracts.
If object-member order or numeric precision affects a downstream system, the formatter output needs an explicit contract. Valid JSON alone does not prove that another parser will interpret every detail the same way.
Pretty and Compact do different work
| Behavior | Pretty | Compact |
|---|---|---|
| Validation | Requires a valid strict JSON object or array. | Requires a valid strict JSON object or array. |
| Object keys | Sorts keys recursively. | Preserves their input order. |
| Array values | Preserves order. | Preserves order. |
| Whitespace | Adds two-space indentation and line breaks. | Removes insignificant whitespace. |
| Number tokens | Re-emits their original text. | Re-emits their original text. |
| Best fit | Review, diff preparation, and stable human-readable output. | Small payloads or systems where the original member order must remain visible. |
01Choose Pretty only when sorted keys are acceptable
TeenyTool’s Pretty mode recursively sorts the members of every JSON object before indenting the output. Arrays retain their original sequence. This produces stable, scannable output, but it is a semantic distinction worth documenting.
RFC 8259 defines an object as an unordered collection and an array as an ordered sequence. A conforming data model should not assign meaning to object-member order. In practice, a human review, snapshot, signature process, or fragile consumer may still expect the input order to remain visible.
Use Compact when that order must stay unchanged. If a system breaks after object keys move, document the dependency instead of calling sorted output a data change that JSON itself guarantees.
02Separate number text from numeric meaning
The formatter validates input with Apple’s JSONSerialization, then uses its own token scanner for output. Number tokens are emitted exactly as written. A value such as 149.99, 1e6, or a long integer is not rewritten through a floating-point string conversion during formatting.
This preserves the token text, not every downstream interpretation. RFC 8259 allows implementations to set limits on number range and precision, and it notes that interoperability is strongest for integers within the exact range commonly shared by IEEE 754 binary64 implementations.
Keep identifiers as strings when leading zeros or every digit is contractual. For money, large counters, and signed payloads, verify the receiving parser instead of assuming that unchanged text means unchanged numeric behavior.
03Know what the validity check does not prove
The green Valid JSON state means the input parsed as JSON. It does not verify required fields, a JSON Schema, an API contract, allowed values, signatures, data freshness, or business rules. It also does not repair comments, trailing commas, or JSON5 syntax.
Use a schema validator or the destination system when structure matters. Use JSON Diff when the task is comparing two valid payloads. Use an editor or jq for repeatable transformations and automated pipelines.
Formatting is a presentation step. It can make a manual review easier, but it cannot certify that the payload is safe to send or correct for an endpoint.
04Keep private scratch payloads local
Do not paste production payloads, support exports, logs, JWTs, customer fields, internal feature flags, or private admin-screen data into an unfamiliar website. A formatter changes whitespace, but a web page still has access to the text unless you have verified its behavior.
TeenyTool’s normal JSON formatting does not need the network. The product’s documented network exceptions are license validation, update checks, IP Address, and DNS Lookup. These are separate from the JSON Formatter.
Use a web formatter for public examples or fake documentation data if its convenience wins. Use a local tool when sanitizing the input would take longer than formatting it.
A safe manual workflow
- Open teenytool from the menu bar.
- Search for "JSON" or open the Developer category.
- Choose JSON Formatter.
- Paste the payload and confirm the Valid JSON state.
- Choose Pretty only if recursively sorted object keys are acceptable; otherwise choose Compact.
- Review the first and last object, array order, important number tokens, and any secrets before copying.
For a design handoff, pair the payload with the source file, intended destination, and acceptance state. The TeenyApps Mac design handoff checklist gives that packet a clear boundary.
Color-token JSON needs both value and context
A JSON color token can be valid and still misrepresent the intended color. A formatter cannot tell whether a hex value came from sRGB or a wider gamut, whether alpha was rounded, or whether a constant replaced an adaptive asset.
The TeenyColor guide to copying color codes on Mac documents those boundaries. Put the format, color space, UI state, and source token beside the formatted JSON when they matter to implementation.
Common questions
Does Pretty mode change JSON object-key order?
Yes. TeenyTool Pretty mode recursively sorts object keys while preserving array order. JSON objects are unordered by the JSON specification, but a consumer that relies on member order should use Compact mode and treat that dependency as application-specific.
Does TeenyTool preserve large JSON numbers exactly?
TeenyTool re-emits the original number tokens, so formatting itself does not rewrite their text. A downstream parser can still round or reject a value outside its supported numeric range or precision.
Does the formatter validate a JSON schema?
No. TeenyTool checks whether the input is a valid strict JSON object or array. It does not confirm a required schema, API contract, field type, or business rule.
Sources checked
- TeenyTool mode, ordering, validation, number-token, copy, and network claims were checked against the local homepage and source files for
JSONFormatterView, the tool catalog, shared output panel, licensing, IP Address, and DNS Lookup. - RFC 8259 for object and array ordering, whitespace, number interoperability, and strict JSON syntax.
- Apple JSONSerialization documentation for the parser used in TeenyTool’s validity check.
- Apple NSPasteboard documentation for macOS pasteboard behavior.
Format JSON without uploading it.
teenytool is a $14.99 Mac menu bar toolbox with JSON Formatter, JSON Diff, JWT Decoder, Base64, YAML, CSV, image tools, color tools, PDF tools, and more.