How to use the json to tsv converter
- Paste your JSON into the text area. It can be an array of objects like
[{"a":1}]or a single object like{"a":1}. - The json to tsv converter parses the input and collects every unique key across all objects to build the header row.
- Nested objects and arrays are serialized back to compact JSON strings so they fit inside a single cell.
- Tabs and newlines inside string values are replaced with spaces to keep the table structure intact.
- Copy the resulting TSV text directly from the output area.
How the conversion works
The converter uses JSON.parse to read the input. If the root value is an array, each element should be an object. The tool iterates through every object and records keys in the order they first appear, building a stable set of column headers for the json to tsv transformation.
For example, given [{"name":"Ada","role":"dev"},{"role":"admin","name":"Bob"}], the headers become name then role. Each row is filled by looking up the corresponding key. Missing keys produce an empty cell. Primitive values (strings, numbers, booleans) are written directly. Null becomes an empty cell. Objects and arrays are re-serialized to compact JSON so they occupy exactly one cell without breaking the tab-delimited format.
Handling special characters
TSV relies on literal tab characters (U+0009) as delimiters and newlines (U+000A) as row separators. If a string value contains a tab or a newline, writing it raw would corrupt the table. This converter replaces any tab or newline character inside cell values with a single space before output.
Unicode characters such as emoji, accented letters or CJK ideograms pass through unchanged because TSV has no encoding restriction beyond what the consuming application expects. The output is plain UTF-8 text.
When to use TSV instead of CSV
Comma-separated values (CSV) require quoting rules when fields contain commas, quotes or newlines. TSV avoids most of that complexity because tabs rarely appear in natural text or numeric data. Many command-line tools like cut, awk and database bulk-load utilities accept TSV natively.
If you need to present the same data visually on a web page, consider using the json to html table converter instead. For documentation sites, the json to markdown table tool produces pipe-delimited tables. And if you need a strict hierarchical format, the json to xml converter preserves nesting without flattening.
Common edge cases
A few inputs deserve attention when converting json to tsv:
- Empty array: produces no output because there are no keys to form headers.
- Mixed types in an array: if the array contains non-object elements like bare strings or numbers, the converter reports an error since rows cannot be mapped to columns.
- Deeply nested data: nested objects are flattened into JSON strings, not expanded into multiple columns. Use a dedicated flattening step first if you need dotted column names.
- Very large files: the tool processes everything in memory. For multi-megabyte payloads, a streaming command-line approach may be more appropriate.
Reference: input and output examples
| JSON input | TSV output |
|---|---|
[{"a":1,"b":2}] | a\tb\n1\t2 |
[{"x":1},{"y":2}] | x\ty\n1\t\n\t2 |
{"k":"v"} | k\nv |
[{"n":null}] | n\n |
In the second row, the union of keys is x and y. The first object lacks y, so its cell is empty. The second object lacks x, producing the same effect.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simple array | JSON input: [{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}] | id name / 1 Alice / 2 Bob |
| Nested objects | JSON input: [{"user":{"name":"Eve","active":true},"score":95}] | user score / {"name":"Eve","active":true} 95 |
| Single object | JSON input: {"city":"Tokyo","population":13960000} | city population / Tokyo 13960000 |
FAQ
What happens if my JSON is invalid?
The converter displays the exact error message returned by the built-in JSON parser, including the position where parsing failed. Fix the syntax and paste again.
Does this tool upload my data to a server?
No. Parsing and formatting happen entirely in your browser using JavaScript. Nothing leaves your device.
How are nested objects handled?
Nested objects and arrays are converted back to compact JSON strings so they fit within a single TSV cell without introducing extra tabs or newlines.
Can I convert a single JSON object rather than an array?
Yes. A single object produces a two-row TSV: the first row contains the keys as headers and the second row contains the corresponding values.
Why are tabs inside my string values replaced with spaces?
Literal tabs would break the column alignment of the TSV format. Replacing them with spaces preserves readability while keeping the table structure valid.
What encoding does the output use?
The output is plain text in UTF-8. You can save it as a .tsv file and open it in spreadsheet applications or process it with command-line tools.