Space to JSON array

Words in, valid JSON out.

Turn a space separated list into a valid JSON array. Splits on any run of whitespace, trims each item, escapes quotes, and runs in your browser.

Paste your text to begin
0 chars / 0 words
bytes uploaded
0
items per list
No cap
usage limit
None

The tool

What the space to JSON array converter does

Paste a space separated list and get back a valid JSON array of strings. Each run of whitespace acts as one separator, each item is trimmed, and empty items are dropped, so a list with double spaces or a stray line break still converts cleanly.

The output is pretty-printed with two-space indentation, which is the one output format this route produces. It runs in your browser, so nothing is uploaded, there is no item cap and no run limit.

The detail that matters

Splitting on a run of whitespace, not a single space

Most converters that offer a space option split on one space character. Feed one of those a list with a double space in it and you get an empty item in the middle of your array, which then has to be cleaned out by hand.

This route treats any unbroken run of whitespace as a single separator. Two spaces, a tab, a line break, or all three together count as one boundary between items. That means a list copied out of a terminal, a spreadsheet cell or a wrapped email converts without needing to be tidied first.

How it works

How to convert a space separated list to JSON in three steps

There is nothing to configure, so this is genuinely a paste-and-copy job.

Step 1
Paste the list. Items separated by spaces, tabs or line breaks all work, in any mixture.
Step 2
Run the conversion. It happens instantly, on your own machine.
Step 3
Copy the array. Check the item count against what you expected, since that is the fastest way to catch a value that contained a space you did not know about.

What you get back

Every item comes back as a string

This is the thing that surprises people most often, so it is worth being blunt about. The array is always an array of strings. Paste 42 and you get "42". Paste true and you get "true". Paste null and you get "null".

There is no type detection, because guessing types from a flat list is where these converters go wrong. A product code like 007 becomes the number 7 if something infers a type, and the leading zeros are gone for good. Keeping everything a string means nothing is silently reinterpreted, and casting the two values you actually wanted as numbers is a smaller job than finding the ones that got corrupted.

Valid output

Quotes, backslashes and accents come out legal

Items containing a double quote or a backslash are escaped properly, so the array is valid JSON and will parse. A word like "hi" with quotes around it stays intact inside the string rather than terminating it early and breaking the file.

Non-ASCII text passes straight through. Accented words and CJK characters are preserved exactly as pasted, since the conversion never transliterates or strips anything.

Scope, stated honestly

What this converter does not do

It produces a flat array of strings and nothing more elaborate. There are no objects, no nesting and no key-value output, so a table with several columns is not a job for this page.

No duplicate removal
Repeated items are kept, in order. The remove duplicate lines route is where deduplication lives.
No empty strings
Empty items are always dropped, so a deliberate empty string cannot be produced here.
No compact output
The result is always pretty-printed with two-space indentation. The JSON minifier route is the one that compacts it.
No file upload or API
It works on text pasted into the page, one list at a time.

Other separators

When your list is not separated by spaces

If your items contain spaces of their own, this is the wrong route, because each word becomes its own item. A list of full names or product titles needs a separator that is not whitespace.

There are separate pages for comma, semicolon, colon, pipe, slash, tab, caret, tilde and double-space lists, and a custom delimiter route for anything else. Picking the page that matches your actual separator is faster than post-processing a wrong result.

Who it's for

Who converts a space separated list to JSON, and when

Mostly developers turning something informal into something a program can read. A list of flags, IDs, tags or filenames pasted from a terminal, a chat message or a ticket, needed as an array in a config file, a test fixture or a request body.

It is also a fast sanity check. Converting a list and counting the items tells you immediately whether one of your values contains a space it should not, because the item count comes back higher than the number of things you pasted.

FAQ

Space to JSON array questions

Everything below is answered in full, nothing to click open.

How do I convert a space separated list to a JSON array?

Paste the list and run the conversion. Each whitespace-separated item becomes one string in a valid JSON array.

Is the converter free?

Yes. No item cap and no run limit, because the work happens on your own device.

Is my list uploaded anywhere?

No. The conversion runs entirely in your browser. No request goes out when you run it.

What happens to double spaces?

Nothing bad. A run of whitespace counts as one separator, so no empty items appear in the output.

Does it split on tabs and line breaks too?

Yes. Any whitespace acts as a separator, so a mixed list from a terminal or a spreadsheet converts fine.

Are numbers converted to numbers?

No. Every item comes back as a string, so 42 becomes "42". Nothing is type-inferred.

Why keep everything as a string?

Because type inference corrupts values like 007 or 1e5. Strings preserve exactly what you pasted.

Are quotes and backslashes escaped?

Yes. The output is valid JSON, so an item containing a quote or a backslash parses correctly.

Does it handle accented or non-English text?

Yes. Accented characters and CJK text pass through unchanged.

Does it remove duplicates?

No. Repeated items are kept in order. Use the remove duplicate lines route if you need them gone.

Can I keep empty items as empty strings?

No. Empty items are always dropped, which is a deliberate limit of this route.

Can I get compact output on one line?

Not here. The result is always pretty-printed. Run it through the JSON minifier for a compact version.

What if my items contain spaces?

Then this is the wrong route, because each word becomes a separate item. Use a delimiter route that matches your separator.

Which other delimiters have their own pages?

Comma, semicolon, colon, pipe, slash, tab, caret, tilde and double space, plus a custom delimiter route.

Is there a limit on list length?

No. Nothing is sent anywhere, so nothing is metered or capped.

Can I upload a file?

No. It works on text pasted into the box.

Is there an API or batch mode?

Not currently. This is a single-list tool running in your browser.

Does it work on phones?

Yes, identically in any modern mobile browser.

Does it produce objects or nested JSON?

No. The output is always a flat array of strings.

Why does my array have more items than I expected?

Almost always because one of your values contains a space, so it was split into two items.

Is the output valid JSON I can paste straight into a file?

Yes. It is produced by a JSON serialiser, so it parses as-is.

Is it safe for confidential lists?

Yes. Nothing is transmitted or retained, because nothing leaves your browser.

Paste the list, take the array.

Runs in your browser with nothing uploaded, no item cap and no run limit.

Convert to JSON