Skip to content
Allin

Lines to JSON array

Turn a list of lines into a JSON array of strings. Drop a file in rather than pasting it — it is read in your browser and never uploaded.

Lines to JSON array works straight from this page — free, instant, nothing to install. You will find it under Web & network, with Head / tail (first & last lines) and Wrap lines in HTML tag for the neighbouring cases.

How to use it

  1. Open the tool — no signup or install needed.
  2. Enter your input or adjust the available options.
  3. Get your result instantly, then copy or download it.

Frequently asked questions

What does Lines to JSON array do?

Turn a list of lines into a JSON array of strings. Drop a file in rather than pasting it — it is read in your browser and never uploaded.

When would I actually use this?

Getting usable data out of something that was never meant to be parsed: pulling every address out of a pasted thread, turning a column of lines into a JSON array or an SQL IN clause, renaming a hundred identifiers from snake_case to camelCase in one pass.

What is the most common mistake?

Trusting an extraction to be exhaustive. A pattern that catches every address in the sample will still miss the one wrapped across a line break, the one written with a display name, and the one an email client turned into a link — count what came out against what you expected before you use the list.

How is Lines to JSON array different from Head / tail (first & last lines)?

They sit next to each other but answer different questions: Head / tail (first & last lines) is the one to open when you need it to keep just the first or last N lines of your text. Works on a pasted block or on a file you drop in. Pick whichever matches what you're starting from — both are free.

Is there a tool for the next step?

Wrap lines in HTML tag is the closest one after this: Wrap each line in an HTML tag of your choice (e.g. li, p, td).

Where do the figures come from?

Extraction runs on patterns, not on a parser: it recognises the common shapes of an address, a URL or an IP rather than validating them against their specification. That is the right trade for a paste, and the wrong one for input you are about to store.

Further reading

All guides
ExplainerJSON to CSV When the Structure Is Nested: Why There Is No Right AnswerThe same two orders come out as five columns from one converter and ten from another, and neither is wrong. Dotted paths, arrays of scalars, arrays of objects and records with different keys — four decisions, made for you, usually silently.ExplainerSemicolon, Tab, Pipe: Choosing a Delimiter That Survives the TripWhy the reader's language decides the delimiter, what the converter does to the quoting when you switch, what the sep= first line really is, and the count of quoted cells on the same export written five ways.How-toRegex Basics: A Beginner's GuideA regular expression is a pattern for matching text. Here are the building blocks — character classes, quantifiers and anchors — with a worked example.GuideSQL Formatting and the IN Clause That Breaks ProductionBuilding an IN list by string concatenation is both the classic injection vector and a performance cliff. Parameterisation fixes the first structurally, because the plan is compiled before any value arrives. The second needs arithmetic: the vendors' documented parameter ceilings, and what a query whose text changes with every list length does to a plan cache.ExplainerXML to JSON: Attributes, Repetition, and the Single-Element Array TrapTwo documents that differ only in how many children exist produce two different JSON shapes, and no converter can tell them apart without a schema. Plus what this one really does with attributes, mixed content and whitespace — and the one thing it still cannot record.ExplainercamelCase vs snake_case: A Guide to Naming Conventions in CodecamelCase, snake_case, PascalCase, and kebab-case explained: what each looks like, where it is the convention, and how to choose one consistently.