Text

Text to JSON Array Converter

Convert a list of lines or delimited text into a JSON array of strings, numbers or objects, with type coercion, key naming, deduplication and correct escaping of every value.

Last reviewed by the Radiatus Cloud team

JSON appears here.

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

The escaping is the part people get wrong

Building a JSON array by joining strings with quotes and commas works until a value contains a quote, a backslash, a newline, a tab or a control character. Each of those has to be escaped, and characters below U+0020 must be escaped even though they are invisible in the source. Doing it by hand in a text editor with find and replace produces JSON that parses most of the time, which is worse than JSON that never parses because the failure arrives later and further away.

Types change what the JSON means

A list of numbers can become an array of strings or an array of numbers, and the two are not interchangeable. A consumer that sorts an array of strings puts 10 before 9. A consumer expecting a number and receiving a string may coerce it, reject it or compare it by character. Choosing deliberately, rather than accepting whatever the tool defaults to, prevents a class of bug that surfaces well downstream of the conversion.

Objects need keys

Delimited input can become an array of objects keyed by a header row, which is the shape most APIs and configuration files expect. Where there is no header, keys can be generated positionally. Duplicate keys in a header are a real problem, since JSON objects cannot hold two identical keys and one value silently wins, so they are detected and reported rather than allowed through.

Related tools

  • Emoji Picker & Copier — Browse, search, and copy emojis by category. Collect multiple emojis and copy them all at once. Recently used emojis saved locally.
  • Text to Speech Player — Convert text to natural speech using the Web Speech API. Adjustable voice, speed, pitch, and volume with playback controls.
  • Speech to Text Transcriber — Transcribe speech to text using your microphone. Supports multiple languages with continuous listening, copy, and download features.
  • Instagram Caption Generator — Generate Instagram caption ideas from a topic, tone, and optional CTA. Fast, template-based suggestions.

Frequently Asked Questions

Which characters have to be escaped in JSON strings?

Double quote and backslash always, and every character below U+0020 including newline, tab and carriage return. Forward slash may optionally be escaped and does not need to be. Getting one of these wrong produces JSON that parses for most inputs and fails for some.

Should numbers be strings or numbers?

It depends on the consumer, and the choice matters. Sorting an array of numeric strings puts 10 before 9, and a consumer expecting a number may coerce, reject or compare a string differently. Identifiers with leading zeros must stay strings, since JSON numbers drop them.

What happens to duplicate keys?

A JSON object cannot hold two identical keys, so one value silently wins. Duplicates in a header row are detected and reported here rather than passed through, because the resulting data loss is invisible in the output.

Is the output valid JSON?

Yes. Values are serialised with the browser JSON serialiser rather than by string concatenation, so escaping is correct for every input including control characters, quotes, backslashes and characters outside the basic multilingual plane.

What is the difference between an array of arrays and an array of objects?

An array of arrays preserves position and is compact. An array of objects names each field, which is self describing and much larger. Most APIs expect objects; data interchange formats optimised for size use arrays.

Privacy & Security

Everything runs in your browser; nothing is uploaded.

Data: None
Client-side-Side
Active
v1.0

How to Use

Paste lines or delimited text and choose the JSON shape you need.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.