JSON to Text Converter
- Plain text is lines of characters with no record, field or type structure (FMT-text-structure), so the objects, arrays and types are gone from the output and cannot be read back out of it. This page has no inverse for that reason.
How do you convert JSON to text?
JSON to text keeps the values and drops the syntax: the braces, brackets, quotation marks and commas come off, and each value lands on its own line.
- Paste the JSON above. It has to be valid JSON, because the values cannot be read out of a document that will not parse.
- Choose whether the keys are kept. With them off you get the values alone; with them on each line reads as a key and its value.
- Choose what joins the elements of an array of values, so a list of tags can come out on one line rather than several.
- Read the result: one value per line, in the order the document holds them.
This page writes one value per line, keys optionally retained, and a selectable join character for array elements.
JSON to Text Conversion Table
Each JSON shape has two readings here, one with the keys and one without, and the choice is the only thing on this page that changes the output. lines of characters; no record, field or type structure — so nothing you see below can be read back as JSON.
| JSON shape | With the keys kept | With the keys dropped |
|---|---|---|
| "name": "Ada" | name: Ada | Ada |
| "age": 36 | age: 36 | 36 |
| "active": true | active: true | true |
| "note": null | note: | (an empty line) |
| "user": {"name": "Ada"} | user.name: Ada | Ada |
| "tags": ["x", "y"] | tags: x, y | x, y |
| an array of objects | one line per value, path first | one line per value |
A format is defined by what it can say. The rows below put the two halves of this conversion side by side, so the gap the conversion has to cross is a thing you can read rather than a thing you find out later. Every value in the table is the wording the defining document uses, not a summary of it, and a dash means the format has no answer to that row at all.
| What it says | JSON | plain text |
|---|---|---|
| Specification | RFC 8259, Standards Track, December 2017; also ECMA-404 | — |
| Media type | application/json | — |
| Structure | objects and arrays, nested to any depth | lines of characters; no record, field or type structure |
| Delimiter | a comma (%x2C) between two members of an object and between two elements of an array | — |
| Quoting | double quotes; a quotation mark, a reverse solidus and the control characters U+0000 to U+001F must be escaped with a reverse solidus | — |
| Type set | string, number, boolean, null, object, array | — |
| Nesting | unlimited by the grammar; a parser may set its own depth limit | — |
| Ordering | an object is unordered; an array is ordered | — |
| Comment | none - the grammar has no comment production | — |
| Encoding | UTF-8 | — |
Worked Example: JSON to text
One small object, converted here at build time by the same code the box above runs. The working under it shows each value, the decision taken about it, and the line it became.
{"name":"Ada","age":36} Ada
36 Result: the JSON above is the plain text beside it, and every decision that made it is listed below.
The types went out with the syntax. RFC 8259 gives JSON four primitive types - string, number, boolean and null - and two structured types, object and array. There is no date type and no separate integer type, so a date arrives as a string and every number is read the same way. None of that reaches the output, because a line of text is a line of text.
The escape sequences came out as the characters they stand for, which is what the JSON grammar says they are. RFC 8259 requires JSON exchanged between systems to be encoded as UTF-8, and forbids adding a byte order mark to the front of a transmitted JSON text. A parser may ignore a byte order mark it finds rather than treat it as an error.
Order is the one thing that does survive, and only in part. An array is ordered and its elements come out in that order; an object is not, so the lines follow the order the document happened to be written in rather than an order it promises. That is enough to read by and not enough to rely on, which is the honest reading of what a plain-text output can be used for.
What This Conversion Cannot Carry
This is the one page in the family with no way back, and the reason is worth stating first. JSON has no comments and no trailing commas because RFC 8259's grammar has no production for either. A comma may appear only between two members of an object or two elements of an array, so a comma before the closing brace or bracket makes the text invalid.
- The structure itself
- Plain text is lines of characters with no record, field or type structure (FMT-text-structure), so the objects, arrays and types are gone from the output and cannot be read back out of it. This page has no inverse for that reason.
- A very large integer
- The integer 12345678901234567890 lies outside -(2^53)+1 to (2^53)-1. RFC 8259 §6 lets a parser set its own limits on range and precision, so this is where two parsers start to disagree about the same file. The digits were carried through unchanged.
- A repeated name in one object
- The name "a" appears more than once in one object. RFC 8259 §4 says the names should be unique and records that software receiving a repeated name behaves unpredictably: some implementations keep the last pair, some fail, some keep all of them.
- A byte order mark
- RFC 8259 §8.1 forbids putting a byte order mark in front of a JSON text and lets a parser ignore one it finds. This one was ignored.
Each line above is written by the converter itself, and it appears under your own result whenever your document raises it. Nothing is dropped without one.
What Do You Keep and What Do You Drop?
Whether the keys are kept
With the keys on, each line carries the path to the value and the output can be read by a person; with them off it can be fed to something that wants a plain list. unlimited by the grammar; a parser may set its own depth limit, so a deep document gives a long path.
What joins an array of values
A list of scalars comes out on one line, joined by the character you pick. a comma (%x2C) between two members of an object and between two elements of an array, and that comma is a separator in the document rather than a character in any value.
What the output can no longer say
Nothing about type, nesting or membership. objects and arrays, nested to any depth on the way in; lines of characters on the way out, and no reader can recover the first from the second.
JSON to text in Code
The same conversion in two lines, one per language. Both walk the document and print the leaves; neither keeps the shape. Neither line reports what the conversion could not carry; the converter above does.
Python: print("\n".join(str(v) for v in json.load(open("in.json")).values())) JavaScript: Object.values(JSON.parse(s)).join("\n") Common Mistakes
- Expecting to read the text back as JSON. Plain text has no record, field or type structure, so the document cannot be rebuilt from it.
- Leaving a comment or a trailing comma in the JSON you paste in. Neither is part of the grammar, so the parse stops and names the line.
- Reading an empty line as a missing value. A JSON null writes an empty line, and so does an empty string, so the two look the same afterwards.
Frequently Asked Questions
Is JSON to text the same as JSON to string?
No. Turning a document into a string keeps every brace and bracket and escapes the quotes. This page drops the syntax and keeps the values, one per line.
Why is a comment or a trailing comma not allowed in JSON?
Because the grammar has no production for either. A comma may stand only between two members or two elements, so one before a closing brace makes the text invalid.
What happens to the escape sequences in a JSON string?
They come out as the characters they stand for, so \n becomes a line break and \u0041 becomes the letter it names. The backslashes are part of the syntax, not of the value.
Does the output stay UTF-8?
Yes. The input is read as UTF-8 and the output is written as UTF-8, so accented characters and anything outside ASCII come through unchanged.
Related Conversions
the JSON, XML, CSV and TSV converters are all on one page.