Split a String into a JSON Array

Split a String into a JSON Array turns plain text into a structured JSON array with just a few clicks. Whether you’re working with comma-separated lists, space-delimited words, or newline-separated lines, this tool instantly converts it all into clean JSON. You can trim entries, skip blanks, or even switch between compact and pretty output. Split a String into a JSON Array updates live, supports file input, and lets you copy or export the result.

Paste your input above or import a file below.
No file chosen
Supported file types: .txt, .csv, .tsv, .log, .json, .xml, .md, .ini, .yaml, .yml, .html, .htm, .css
Total items: 0
Options
Trim entries
Ignore empty
Pretty output
Split by:

How to Use:

  1. Paste your input text into the Input Text box or import a file (.txt, .csv, etc.).
  2. In the Options section:
    • Toggle Trim entries to remove surrounding spaces.
    • Toggle Ignore empty to skip blanks.
    • Toggle Pretty output to format the array nicely.
  3. Choose how to split your text:
    • Pick a Split by mode: comma, space, newline, or custom delimiter.
    • If using custom, enter your own character (e.g., |).
  4. View your JSON array live in the JSON Output box.
  5. Use Copy Output or Export to File as needed.
  6. Click Clear All to reset everything.

What Split a String into a JSON Array can do:

Split a String into a JSON Array is great when you’ve got a raw text list and need to convert it into proper JSON fast. You can go lightweight with compact output or clean things up with trim and pretty options. It’s flexible enough to work with nearly any delimiter and smart enough to filter blanks and extras on the fly. It’s handy for APIs, config files, and quick prototyping.

Example:

Before:

apple, banana, , cherry

Settings:

  • Split by: comma
  • Trim entries: On
  • Ignore empty: On
  • Pretty output: On

After:

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

Common Use Cases:

Use this when converting raw pasted text into JSON, like building arrays for JavaScript, sanitizing CSV fragments, or getting clean input from form data. It’s quick, flexible, and handles the formatting for you live in your browser.

Useful Tools & Suggestions:

Before splitting, Trim Text helps clean up extra spaces or line breaks that might get in the way. Then, once the array is built, Prettify JSON can be used to format it neatly so it’s easier to work with.