JSON to Markdown: Turning a Nested Dump Into Something You Can Actually Read
JSON is a machine format that humans tolerate. It's fine at three levels deep. At eight levels deep, with an array of 400 objects sitting in the middle of it, you're scrolling through a wall of braces trying to work out which closing bracket belongs to what. Anyone who has opened a raw API response in a browser tab knows the feeling.
Converting JSON to Markdown takes that tree and re-expresses it as a document.
Object keys become headings. Nested objects become nested sections. Arrays of similar records become
tables you can scan with your eyes instead of your Ctrl+F key. Drop a .json
file into the tool above and you'll have it in a couple of seconds — free, no sign-up, 50 MB limit,
nothing kept on our end.
What Happens to the Structure
The conversion is a walk down the tree, and each JSON construct maps onto a Markdown one:
- Objects become sections. A top-level key like
customerturns into a heading, and everything under it sits beneath that heading. Depth becomes heading level, so the hierarchy you had to infer from indentation is now visible at a glance. - Scalar key/value pairs become labelled lines.
"status": "active"reads as status: active. Quotes, colons and trailing commas all disappear, and with them roughly a third of the characters in a typical file. - Arrays of scalars become bullet lists. A list of tags or IDs stops looking like a data structure and starts looking like a list.
- Arrays of uniform objects become tables. This is the big one, and it gets its own section below.
- Empty and null values. A field set to
null,""or[]carries almost no information but costs tokens on every record it appears in. Flattening collapses that noise instead of repeating it 500 times.
The thing raw JSON does badly for a reader is exactly the thing it does well for a parser: every record restates every key. Deeply nested JSON hides its shape behind punctuation. Markdown puts the shape on the surface.
Arrays of Uniform Objects Are the Ideal Case
If your JSON is a list of records that all share the same keys — orders, users, products, log entries, search results — you get the best possible outcome: one Markdown table, keys as column headers, one row per record. Two hundred objects that took 3,000 lines of raw JSON collapse into 200 table rows.
The saving is not cosmetic. In raw JSON, every one of those 200 records repeats the field name
"created_at", the field name "customer_id", and so on. In a table, each
name appears exactly once, in the header row. For an LLM working against a context limit, that's
the difference between a dataset fitting and not fitting. The token counter under the output makes
this concrete — convert the same file both ways and watch the number drop.
Where it degrades: ragged records. If half your objects have an address
block and the others don't, or if one field is itself a nested object, a flat table can't represent
that cleanly. You'll get a wider table with gaps, or nested content pushed out into its own section.
If your data is genuinely tabular, exporting it as CSV first and using the
CSV to Markdown converter
will usually give tidier tables, because CSV can't be ragged in the first place.
When You Should Not Convert At All
Worth being straight about this, because plenty of pages selling converters won't be: an LLM can read raw JSON perfectly well. It's a format models have seen an enormous amount of during training. You are not required to convert anything.
Keep the raw JSON when the exact keys matter. If you're asking a model to write code against an API response — a TypeScript interface, a parser, a mapping function — it needs the literal key names, the literal nesting, and the literal types. Markdown blurs some of that on purpose. Paste the raw payload, or a trimmed sample of it, and let the model see what it will actually be parsing.
Convert when a human is in the loop, or when tokens are tight. You want to understand what an unfamiliar API returns. You're reviewing a config file someone else wrote. You're feeding a large export into a model and the raw file is 40% punctuation. Those are the cases where a JSON to Markdown converter earns its place. Everything else is taste.
Minified Files, Pretty-Printed Files, and JSON Lines
Three variants show up constantly and they behave differently:
- Minified JSON — one enormous line, no whitespace. It's the format most APIs actually return. Unreadable to a person, and awkward for models too, because there are no line breaks to anchor on. Conversion helps most here; you go from a single 200 KB line to a structured document.
- Pretty-printed JSON — already indented. Easier to read, but the indentation itself is now thousands of leading spaces you're paying tokens for. Markdown gets you the hierarchy without the whitespace bill.
- NDJSON / JSON Lines — one complete JSON object per line, no wrapping array.
Standard for logs and streaming exports. It's uniform by nature, which makes it close to ideal
for table output. If your file is
.jsonlor.ndjson, rename it to.jsonor wrap the lines in an array before uploading.
One practical warning: a malformed file won't convert. Trailing commas, single quotes instead of
double, unescaped newlines inside strings, or a stray NaN from a Python export will all
fail validation. Run the file through a linter first if it came from somewhere unusual.
Where This Gets Used
- Understanding an undocumented API. Capture one real response, convert it, and you've got a readable outline of the response shape — better than most vendor docs, and you can hand it to a model as a reference.
- Reviewing analytics or export dumps. A few thousand events from a product analytics tool become a table you can actually ask questions about.
- Auditing config. Kubernetes manifests, ESLint configs, deployment settings — converted to Markdown, the inheritance and overrides become obvious in a way they aren't in nested braces.
- Writing documentation. Markdown output drops straight into a README, a wiki page, or a docs site without reformatting.
- Comparing two payloads. Convert before and after, diff the Markdown. Structural changes stand out far more than they do in a JSON diff full of moved brackets.
If the JSON Lives in a Codebase, Convert the Codebase
Most JSON files aren't standalone. They're a package.json, a fixture file, a seed
dataset, an OpenAPI spec — sitting inside a repository next to the code that reads them. Converting
that one file in isolation gives a model the data but none of the context.
When that's the situation, use the GitHub repository to text converter instead, or the local directory converter if the project is on your machine and not pushed anywhere. Tick the JSON files plus the source files that consume them and you get one text blob containing both sides of the relationship. There's a GitLab version too. This is nearly always the better move for anything development-related — the single-file converter is for JSON that arrived on its own.
Frequently Asked Questions
How do I convert JSON to Markdown?
Upload the .json above and it comes back as Markdown — nested objects as heading levels, arrays of uniform records as pipe tables, and keys as labelled fields. Free, 50 MB per file, no account. Download as .md or copy it into a doc, an issue, or a prompt.
Does an array of objects become a table?
When the objects share a shape, yes — that is the case Markdown handles best. A list of records with the same keys converts to a pipe table with one column per key, which is far easier to scan than the raw array. Heterogeneous arrays, where each element has different fields, fall back to sections instead because there is no consistent column set to build.
How does it handle deep nesting?
Nesting maps onto heading depth, and Markdown runs out at ######. A config file nested eight levels deep will bottom out and the deepest layers flatten into the level above. For structures that deep, plain text is not worse — nothing readable was going to survive either way.
Is this good for documenting an API response?
It is a fast way to get a real payload into a docs page or a pull request without hand-formatting it. Paste a sample response, convert, and you have a table of fields that renders anywhere Markdown renders. What it cannot infer is which fields are optional or what the types mean when a value happens to be null in your sample.
JSON to Markdown or JSON to text for an LLM?
Markdown if the shape carries meaning — you want the model to understand that these fields belong to that object. Text if you are chunking for embeddings, where syntax characters are noise that dilutes the vector. For a single payload you want explained, Markdown reads better and costs barely more.
Markdown or Plain Text, and What Else Is Here
If you don't want any structure at all — you're building embeddings, indexing for search, or squeezing a file down to the smallest possible token count — take the JSON to plain text route instead. It strips the syntax entirely rather than translating it. The format toggle at the top of this page switches between the two and carries your selected file across, so you can try both without uploading twice.
For other structured formats, XML to Markdown handles feeds, SOAP payloads and enterprise schemas, and HTML to Markdown handles saved web pages. File2Txt is the general entry point if you'd rather not pick a page — it takes PDFs, Office files, images and archives as well. There's a longer write-up on preparing files for LLMs if you want the wider argument.
Repo2Txt is built and maintained by v12hero, an independent developer building privacy-first native and web apps.