Skip to content
UniKit

List to JSON array

Turn a line-based or delimiter-separated list into a valid JSON array — quoting and escaping of quotes, backslashes, newlines, tabs and control characters is implemented character by character, with an optional 2-space pretty layout plus item, character and escaped-item counts.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

List

JSON array

The output is valid JSON you can parse directly.

Paste a list to build a JSON array

Items: 0 · Characters: 0 · Need escaping: 0 · Input lines: 0

What this tool does

  • Turn a column copied out of a spreadsheet into a JSON array you can paste into config, API docs or fixtures without hand-writing quotes and commas.
  • When values contain quotes, backslashes or tabs the built-in escaping keeps the result parseable — no more “looks like JSON but JSON.parse throws”.
  • Use pretty mode to produce a readable multi-line array for code review or diffs.

Example

Input

apple
banana
cherry

Output

["apple","banana","cherry"]

Compact mode keeps everything on one line; switch pretty on and each item gets its own 2-space indented line — the output stays valid JSON either way.

Frequently asked questions

How are quotes escaped in the JSON?

A double quote becomes \", a backslash becomes \\, newline and tab become \n and \t, and every other control character (U+0000–U+001F) becomes \uXXXX. Escaping runs character by character, so the output is always a valid JSON string that JSON.parse accepts.

Is the field order stable?

The output is an array, not an object, so there is no field-order question — items keep the order you typed. Sort them with a list-sorting tool first if you need a specific order.

What happens to blank lines and surrounding spaces?

Both “Trim each item” and “Drop empty items” default to on, so blank or whitespace-only lines are left out. Turn them off to keep empty strings in the array.

How many items can it handle?

200,000. Past that it reports an error instead of freezing the tab, because the conversion runs on the browser main thread.

Keywords:列表转json转 json 数组list to jsonjson 数组文本转 jsonjson array转义escape quotes批量加引号

Related tools