Convert a list to a JSON array

Paste one item per line and get a valid JSON array of strings back. Each line becomes one string element; quotes, backslashes, and tabs inside a line are automatically escaped to stay legal JSON. Runs in your browser - your list never hits our servers.

Input
Ready
Output
Live

A list becomes a JSON array, one item per string

This is the narrowest JSON output you can produce from a list: an array of strings. Every non-empty input line becomes one element, wrapped in double quotes, with any characters inside the line that would break JSON (`"`, `\`, `\t`, control characters) escaped to their JSON-safe form. Nothing else is inferred - numbers stay as quoted strings, booleans stay as quoted strings. If you need typed output, run a transformation first, then feed the result in here.

Two toggles control the output shape. `Pretty print` wraps the array across lines with two-space indentation so a human can scan it; turning it off gives you a single-line compact form that diffs and greps well. `Skip empty` (on by default) filters out zero-length lines, so trailing blanks in your paste do not produce empty strings in the array. Turn it off if you genuinely want `""` entries - the tool will preserve them in position.

One input line = one array element. A literal newline in the textarea starts a new item; this tool does not support multi-line JSON string values. If your source data genuinely has newlines inside a string, pre-escape them (`\n`) before pasting, or build the JSON directly. All escaping on the remaining characters comes from the browser's built-in `JSON.stringify`, so the output parses cleanly in any JSON parser - Python, jq, `JSON.parse`, a Postgres `jsonb` column, anywhere.

How to use convert a list to a json array

  1. 1Paste your list into the input panel, one value per line
  2. 2The output is a JSON array of strings - each line becomes one element
  3. 3Toggle Pretty print off if you want a compact single-line array for diffs or grep
  4. 4Toggle Skip empty off if you want empty input lines preserved as `""` elements
  5. 5Copy the array or download it as a .json file from the output panel

Keyboard shortcuts

Drive ListShift without touching the mouse.

Shortcut Action
Ctrl ZUndo last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor
EscExit fullscreen
Ctrl KOpen the command palette to jump to any tool
Ctrl SSave current pipeline draft Plus
Ctrl PRun a saved pipeline Plus

What this tool actually produces

Fixed behaviors, with two toggles for formatting.

A JSON array of strings - always

The output is always `[…]` with string elements. Numbers, booleans, and nulls are not inferred - `42` in the input becomes `"42"` in the output. That keeps the conversion lossless and predictable; if you need typed data, you probably want to write the JSON directly rather than round-trip through a list.

Automatic JSON-safe escaping on in-line characters

Quotes, backslashes, tabs, and control characters inside each line are escaped using `JSON.stringify` rules (`"` becomes `\"`, tab becomes `\t`, and so on). Note the constraint: the tool is line-based, so each textarea line is exactly one array string. A literal newline in your paste starts a new element; it cannot live inside a single JSON string value.

Pretty-print vs compact

Pretty print (on by default) uses two-space indentation with one element per line - ideal for reading or pasting into docs. Off gives you `["a","b","c"]` on a single line - ideal for compact storage, URL params, or anywhere a JSON array needs to fit on one line.

Skip-empty toggle, on by default

Empty lines are dropped before the array is built, so a trailing blank line in your paste does not produce `""`. Turn the toggle off and every line - including blank ones - becomes an element, so you get real `""` entries in the array at those positions.

Runs in your browser

The JSON is built client-side via `JSON.stringify`. Your list never leaves the tab - matters when you are pasting customer emails, internal IDs, or anything else you would not send to a random server.

Worked example

Embedded quotes are escaped automatically; the trailing blank line is dropped.

Input
apple
banana "fresh"
cherry
Output
[
  "apple",
  "banana \"fresh\"",
  "cherry"
]

Settings reference

Two toggles. Everything else - escaping, string-only output, array wrapper - is fixed.

Setting What it does Effect on the sample
Pretty print: on Wraps the array across lines with two-space indentation Produces the 5-line block shown in the example above
Pretty print: off Emits a compact single-line array `["apple","banana \"fresh\"","cherry"]`
Skip empty: on Drops empty input lines before building the array Trailing blank line is ignored - output has 3 elements
Skip empty: off Preserves every line, including empty ones Adds a `""` as the fourth element for the trailing blank
Escaping (automatic) Quotes, backslashes, tabs, and control chars inside each line are JSON-escaped `banana "fresh"` becomes `"banana \"fresh\""`
Newlines in items (not supported) Tool is line-based - a textarea newline always starts a new array element Cannot produce `"line 1\nline 2"` as a single string from pasted input

FAQ

Can this produce typed values like numbers or booleans?
No. The output is always an array of strings. `42` on an input line becomes `"42"` in the output. This keeps the conversion lossless and round-trippable. If you need typed JSON, build it directly - this tool is for when your source is genuinely a list of strings.
What happens to quotes and special characters in my list?
Characters inside each line are escaped automatically using the browser's `JSON.stringify` rules. A double quote becomes `\"`, a backslash becomes `\\`, a tab becomes `\t`, and most control characters (U+0000 through U+001F) get their `\uXXXX` form. The resulting JSON parses cleanly in any standards-compliant parser.
Can a string in the output span multiple lines?
No - this tool is line-based. Every textarea newline starts a new array element, so a JSON string containing `\n` cannot be produced from a pasted multi-line value. If you need that, pre-escape newlines to `\n` in your source before pasting, or build the JSON directly rather than going through this converter.
What is the difference between pretty-print and compact mode?
Pretty print wraps the array across multiple lines with two-space indentation - good for reading, docs, or code review. Compact mode emits a single-line array like `["a","b","c"]` - good for URL params, one-line storage, or diffs where you want the whole value on one line.
What does Skip empty do to my trailing blank lines?
With Skip empty on (default), empty lines are dropped before the array is built, so a trailing blank paste does not produce an extra `""` in the output. Turn it off and every line - blank or not - becomes an element, preserving their position.