Back to Tools

Text to JSON Converter

Transform structured lists, objects, or raw text into valid, pretty-printed JSON data

Input Data (Structured Text)
Parsing Mode
Output Style
Valid JSON Output
Analysis
0 KB
0 Objects

Give plain text a JSON structure

Notes, config snippets, copied tables and one-item-per-line lists are easy to read but awkward for code to consume. This converter reads text you paste and builds a JSON array from it, using one of three parsing modes. It works in your browser and needs no formatting knowledge beyond choosing the mode that matches your text.

Converting text to JSON

  1. Paste your text into Input Data (Structured Text). The small clipboard icon pastes from your clipboard and the trash icon clears the box.
  2. Choose a Parsing Mode: Key: Value Pairs, CSV (Auto-detect) or Array of Lines.
  3. Choose an Output Style: pretty print with 2 or 4 spaces, or minified.
  4. Press Generate JSON.
  5. Use Copy JSON or Download .json, which saves data.json. The Analysis card shows the output size in KB and an item count.

What each mode expects

  • Key: Value Pairs treats blocks of text as records. A record ends at a line containing three dashes or at a blank line. Inside a block, each line is split at its first colon into a key and a value, so a time like 10:30 stays intact in the value. Lines with no colon are skipped. Every value becomes a string.
  • CSV (Auto-detect) takes the first line as the header and turns each following line into an object. Lines are split on commas, tabs, pipes or semicolons, whichever appear. Missing cells become null. You need at least two lines or the result is an empty array.
  • Array of Lines simply returns each non-empty line as a string inside a JSON array.

Realistic uses

  • Converting a contact list typed as Name, Age and City lines into an array of objects for a test fixture.
  • Turning a list of keywords or URLs, one per line, into a JSON array for a script.
  • Cleaning up a copied table with pipe or tab separators into records.
  • Prototyping API responses from documentation-style notes.

Details that matter

Numbers and booleans are not detected; a value such as 30 is written as the string "30". If you need real numbers, post-process the output or use a CSV-to-JSON tool with type detection. Because a blank line also ends a record in Key: Value mode, do not leave empty lines inside a single record. In CSV mode the splitting is not aware of quotes, so a cell such as "Paris, France" would be broken at the comma. Errors are shown in a simple alert message.


Related Tools

Related Tools


Frequently Asked Questions

How do I separate several records in Key: Value mode?
Put a line containing three dashes between records, or leave one blank line. Each block becomes one JSON object, and the objects are returned together in an array. Lines inside a block that have no colon are ignored.
Why are all my numbers wrapped in quotes?
This tool keeps every value as a string; it does not detect numbers or booleans. So 30 appears as "30". Convert types afterward in your own code, or use the CSV to JSON tool, which has an Infer Types option.
What does the CSV (Auto-detect) mode do with the first line?
It treats it as the header row and uses each header as a key. Every following line becomes an object, with cells split on commas, tabs, pipes or semicolons. Empty or missing cells are output as null.
Will a value that contains a colon be cut off?
No. In Key: Value mode only the first colon on a line separates key from value, so a value such as 12:45 or https://example.com remains complete. Only the text before that first colon becomes the key.
Can I get compact JSON for an API request?
Yes. Choose Minified under Output Style and press Generate JSON. The result has no spaces or line breaks. You can copy it or download it as data.json. Copy JSON or Download .json work the same either way.
Support Chat
We typically reply within minutes

Hello! 👋 Before we start, please tell us your name.