Pretty-Print JSON Into a Clean PDF

Reparses and reformats your JSON with two-space indentation, then typesets it in a monospaced face at your chosen size. Invalid JSON is rejected with the parser's own error message, so the tool doubles as a syntax check.

About the JSON to PDF Converter

Minified JSON is unreadable by design. This converter parses the file and writes it back out with proper indentation and one value per line, so nested objects and arrays step across the page the way you would see them in an editor. It then typesets that in Courier at 9, 11 or 13 point on A4 or US Letter.

There is a useful side effect. Because the file has to be parsed before it can be reformatted, anything that is not valid JSON fails immediately — and the message you get back is the JavaScript engine's own parse error, naming the problem and its position. If a conversion is refused, you have learned something more valuable than a PDF.

Key Features

  • Genuine structural indentation: The data is parsed and re-serialised with two-space indenting, so nesting depth is visible as shape on the page rather than implied.
  • Validation built in: Malformed JSON is rejected before conversion with the precise parse error, including where the parser gave up.
  • Monospaced output: Courier keeps keys, values and indentation aligned vertically, which is what makes a deeply nested structure scannable.
  • Three text sizes and two paper sizes: Nine point fits a large configuration onto a manageable number of pages; A4 or US Letter to suit the destination.
  • Consistent formatting regardless of input: The output looks the same whether the source was minified into one line or already prettily formatted, because it is rebuilt from the parsed data.
  • Nothing is transmitted: Parsing and layout both happen in this tab from a library stored on this domain, so payloads containing real data are never sent to a formatting service.

How to Use the JSON to PDF Converter

  1. Add the .json file you want as a document.
  2. Pick a text size and paper size.
  3. Press Convert to PDF.
  4. If it reports a parse error, fix the file at the position given and try again.

How It Works

Because the file is parsed and rebuilt rather than reformatted textually, a few properties of the data are worth understanding.

Comments are not permitted in strict JSON, so a configuration file written with them — which many tools tolerate — will be rejected as invalid. Duplicate keys within the same object silently collapse to the last occurrence, since that is how parsing works, meaning a file with an accidental repetition will convert with one of the values quietly gone. Numeric keys are reordered ahead of string keys and sorted numerically, which can rearrange an object whose keys are numbers. And very large integers beyond the range JavaScript represents exactly will lose precision in the round trip — relevant if your data contains long identifiers stored as numbers rather than strings.

None of these affect ordinary configuration files or API payloads, but if the PDF is intended as an exact record of a file rather than a readable rendering of its data, keep the original alongside it.

As with any conversion through the built-in monospaced font, characters outside the Western European range will not render — string values containing Chinese, Japanese, Arabic or Cyrillic text will come through as blanks.

When You Need It

A developer documenting a webhook payload for a partner's integration team needs a version that can be attached to a specification and read by people who will not be opening a code editor. A formatted PDF sits in the document set alongside everything else, and the payload structure — which may reflect internal data models the partner has signed an agreement to see and nobody else has — does not pass through a public formatter on the way there.

An engineer preserving an API response as evidence in a billing dispute wants a fixed, dated, unalterable record of exactly what the service returned. Converting it to a PDF gives a document that can be attached to correspondence, and doing so locally means the response — which typically contains account identifiers and usage data — is not disclosed to a third party in the course of documenting a disagreement with the second one.

FAQ

Frequently Asked Questions

It says my file is not valid JSON, but it works in my application.
Your application is probably tolerating something strict JSON does not allow. The usual culprits are comments, a trailing comma after the last item in an object or array, single quotes instead of double, or unquoted keys. The error message names the position where parsing stopped, which is normally enough to find it in a second.
Will the key order in my file be preserved?
Mostly. Keys that are ordinary strings keep their original order, but keys that look like integers are moved to the front and sorted numerically, which is a quirk of how objects work rather than a choice made here. Data keyed by numeric identifiers is the case where you would notice.
Can I convert a .jsonl or NDJSON file?
Not directly. Newline-delimited JSON is a sequence of separate documents rather than one, so it will fail the parse. Wrapping the lines into a single array — adding brackets at the ends and commas between the lines — converts it into valid JSON that this tool will accept.
My long ID numbers changed in the PDF.
Numbers beyond the range JavaScript can hold exactly lose their least significant digits when parsed. If your data uses long numeric identifiers, storing them as strings in the source is the standard fix and preserves them exactly. Check any file where identifiers exceed about fifteen digits.
Is my JSON sent to a server to be formatted?
No, and this is worth stating plainly because online JSON formatters are one of the most casually used tools in software work — people paste production payloads into them without a thought. Here the file is parsed by your browser and jsPDF draws the pages in the same tab, both running from code on this domain. Tokens, customer records and internal structures stay on your machine.
Why is the output in Courier rather than a nicer font?
Monospacing is what makes indented data readable — every character occupies the same width, so nested levels line up vertically down the page and a misplaced bracket is visible. A proportional typeface would destroy that alignment and make the structure much harder to follow.