Text to JSON Converter

Have a list of values you need as JSON? Paste it in, tell the tool whether your items are split by line breaks, commas, semicolons, or spaces, and it hands back a JSON array you can copy straight into your code. There's nothing to install and no account to make.

It tidies up as it goes: every item gets trimmed, blank entries are dropped, and if you tick Remove duplicates it keeps the first of each value. The work happens in your browser with the same JSON.stringify your own code would call, so you get standard JSON, pretty-printed with two-space indentation.

Good to know: the result is a flat array of strings, like ["red","green","blue"]. It doesn't build objects, keys, or nested structures, and numbers come back quoted. Nothing is uploaded, since the whole conversion runs on your own machine.
Input Text
Output Text

Turn a plain list into a JSON array

You've got a list sitting in a text file or copied out of a spreadsheet, and something downstream wants it as JSON. Retyping it into brackets and quotes by hand is slow and easy to get wrong, since one missing comma stops the whole thing from parsing. This tool handles that mechanical part. Paste the list, tell it how the items are separated, and you get a valid JSON array back.

It's a small, single-purpose tool, and it helps to know exactly what it makes before you lean on it. The output is always a flat array of strings. That's the honest scope, and the rest of this page walks through what that means and when you'll want something else.

What the tool actually does

Everything runs in your browser with plain JavaScript. Nothing uploads, and no server touches your text. When you press Generate, the tool splits your input on the separator you picked, trims the whitespace off each piece, and drops any empty entries. If you ticked Remove duplicates, it keeps the first copy of each value and discards the rest. Then it calls the browser's own JSON.stringify to write the result, pretty-printed with two-space indentation.

Because it leans on the same JSON.stringify your own code would call, the output is standard JSON that any parser will accept. Quotes, backslashes, and line breaks that happen to sit inside your values are escaped correctly, so you don't have to babysit them. When it looks right, the Copy button drops the whole array onto your clipboard in one click, and generating again just replaces whatever was there.

Once you have your array, you can drop it into the JSON formatter to double-check it and re-indent it however you like before it ships.

The four ways to split your text

You pick one separator from the dropdown, and it decides where one item ends and the next begins:

  • Line breaks, the default. One item per line, and the most reliable choice, because your values can hold commas, spaces, and almost anything else without being split by accident.
  • Commas. Fine for something like red, green, blue, but be careful when a value already contains a comma, such as a street address, because it will be cut in two.
  • Semicolons. Useful when your data is a single line of items separated by semicolons.
  • Spaces. This splits on a single space, so it suits single words best. Runs of extra spaces just create blanks, and those get removed for you.

What a flat array of strings is good for

A plain array of strings covers more real work than it first sounds like. Dropdown options, an allow-list of domains, a set of tags, the values for a database seed, a quick fixture for a unit test, the list of IDs you're about to loop over in a script: all of those are just arrays of strings. If your end goal is one of them, this tool is the whole job, and you won't miss the fancier structures.

Where it stops, honestly

The main thing to keep in mind is that every value comes out as a quoted string. Feed it 1, 2, 3 and you get ["1","2","3"], not numbers. There's no type detection, so booleans and dates stay strings too. If whatever you're feeding needs real numeric values, you'll cast them on the other side.

A few more limits, stated plainly:

  • It builds a flat array only. No objects, no keys, no nesting. A spreadsheet with columns won't come out as an array of objects here.
  • Remove duplicates is case-sensitive. Apple and apple both survive, because to a character-by-character comparison they aren't the same.
  • There's no tab option and no custom delimiter. The four separators above are the entire set.
  • Blank lines and empty items are always stripped. That's usually what you want, though it does mean you can't put a deliberate empty string in the array.

A real example

Say you exported a column of email addresses and pasted 40 of them, one per line. Leave the separator on Line breaks, tick Remove duplicates because exports always seem to smuggle in a repeat or two, and press Generate. Out comes ["[email protected]", "[email protected]", and so on], each address on its own line, ready to paste into a seed script or a config file. The two duplicates you never spotted are already gone. The whole thing takes about as long as it took to read this paragraph.

Getting a clean result

If you have any say in the matter, put one item per line and use the Line breaks setting. It's the one separator that never surprises you, because real values are full of commas and spaces the other options would happily split on. The tool already trims stray spaces from the ends of each item, so you don't have to tidy the list first, but consistent formatting still leaves you with fewer surprises. When your source is comma-separated and some fields contain their own commas, that's the exact case the comma option can't handle, and a good sign your data is really a table rather than a simple list.

When a different tool fits better

When that data is still sitting in a spreadsheet file, the Excel to JSON converter reads the columns straight from the workbook and hands back JSON without the copy-paste step.

If your text is really a table with columns and headers, the CSV to JSON converter turns each row into a JSON object with named fields, the shape a flat array can't give you.

This converter is built for turning a simple list into an array. The moment your data has columns, headers, or rows that each need to become their own object, a flat array is the wrong shape, and a purpose-built converter will give you a cleaner result.

One note on privacy, since people ask: nothing you paste is uploaded. The splitting, trimming, deduping, and JSON output all happen inside your browser, on your own machine. Close the tab and it's gone. That makes the tool safe for internal lists, customer email addresses, or anything you'd rather not hand to someone else's server.

Frequently Asked Questions

Similar tools to explore

DOC </> HTML

Convert Word Doc to HTML

Convert Word documents to HTML format quickly and easily. Free online converter for DOC and DOCX files.

Convert to HTML
Aa

Fancy Font Generator

Transform plain text into stylish Unicode fonts. Copy and paste fancy letters into Instagram, Twitter, Discord, TikTok, or anywhere text is allowed.

Generate Fancy Fonts
abc

Strikethrough Text Generator

Create s̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ text that works on Twitter, Facebook, Discord, and anywhere Unicode is supported. Multiple strikethrough styles available.

Generate Strikethrough
Aa

Small Text Generator

Convert regular text to tiny superscript, subscript, and small caps. Copy and paste miniature text for bios, comments, and aesthetic posts.

Generate Small Text

Remove Duplicate Lines

Streamline and declutter your text with our Remove Duplicate Lines tool, perfect for coding, writing, and data organizing

Remove Duplicates
ABCABC

Upside Down Text Generator

Turn your text upside down: ʇxǝʇ uʍop ǝpᴉsdn. Works on Twitter, Discord, Instagram, and everywhere Unicode is supported.

Flip Text