Text to JSON

Best-effort converter for turning plain text into JSON. Choose “Lines to array” or parse simple key:value lines.

Input
Output (JSON)
Mode
Best-effort disclaimer: This tool makes simple, deterministic assumptions. It will not guess schemas or “fix” messy data. Review the output before you use it in production.

How the Text to JSON Converter Works

Paste plain text, pick a simple parsing mode, and generate JSON that you can copy or download. This is a deterministic, best-effort converter designed for quick cleanup of notes, exports, logs, and scraping results. It runs locally in your browser.

Lines → Array
Lists, bullet exports
Key:value
Simple objects
Pretty JSON
Readable output
_unparsed
Keeps leftovers

Two modes, predictable output

This page intentionally supports only two common patterns because they cover a lot of real workflows and they stay easy to reason about. When you convert text to JSON, the goal is usually to make the data machine-readable without spending time writing a custom script. The converter gives you a quick starting point that you can paste into a debugger, an API client, a database import, or a small utility script.

Lines → Array treats each newline-separated line as a single item. This is the mode to use for lists such as names, IDs, URLs, search queries, or any export that is already one value per line. You can also use it for scraped text where you just want the visible strings in a structured form.

Key:value → Object looks for the first colon in each non-empty line and splits it into a key and a value. It does not do language parsing, schema inference, type guessing, or nested structure detection. The converter keeps the rules simple so you can reliably predict what will happen before you click Convert.

  • Ignore empty lines
    Skip blank lines so the output is compact. Turn it off if empty lines carry meaning in your source, such as intentional spacing in a report.
  • Pretty print
    Formats JSON with indentation for readability. Turn it off if you need a compact payload for copying into a URL, a query, or a limited character field.
  • Trim values
    Removes leading and trailing whitespace from values in key:value mode. Useful for log exports where alignment adds extra spaces.
  • Keep duplicate keys
    If the same key appears multiple times, you can keep all values as an array. If disabled, the last value wins, which is often the simplest behavior.
Best-effort means review the output

The converter is designed to be helpful even when the input is messy, but it is not a validation engine. If your source data has inconsistent separators, missing values, or mixed formats, the output can still be valid JSON while not matching what you intended. Use the summary counters on the page to spot skipped lines or leftovers, then adjust your input or switch modes.

Key:value parsing details and edge cases

Key:value parsing is intentionally straightforward. The first colon in a line splits the key from the value. Everything after that colon is treated as the value, even if it contains additional colons. This helps with timestamps, URLs, and log prefixes where extra colons are common.

Lines that do not contain a colon, or that have an empty key, are not thrown away. Instead, the tool collects them under a special field named _unparsed. That keeps the conversion safe and transparent. You can scan those leftovers, fix the input, and re-run the conversion, or you can keep the _unparsed list as a record of what could not be cleanly represented as a key:value pair.

Duplicate keys are another common problem in scraped data and log exports. By default, the converter uses a predictable rule: the last value wins. This is easy to understand and matches how many config systems behave. If you enable the duplicate keys option, repeated keys are collected into arrays so you keep every value without losing information.

Types are not inferred

Values are treated as strings. The tool will not convert “22” into a number or “true” into a boolean because that quickly becomes ambiguous. If you need typed JSON, convert first, then adjust types in a code editor or a small script.

Nested objects are not guessed

Keys are not interpreted as paths. A line like “user.name: Alice” stays a single key, not a nested object. This avoids surprising output and keeps the tool aligned with quick, deterministic conversions.

Practical workflow tip

If your input uses “=” instead of “:”, do a quick find-and-replace in your editor, then use key:value mode. Keeping the converter rules small makes outcomes more predictable, and it usually takes only a small pre-clean step to fit your data into one of the supported shapes.

What this tool is for

This converter is most useful when you have text that is almost structured but not quite. A few examples: exported logs you want to paste into an issue, a list of URLs you want to feed into a crawler, scraped label:value pairs you want to store, or plaintext notes you want to convert into a small JSON fixture for tests.

The output is designed to be immediately copyable. When the JSON looks correct, you can copy it into a destination system or download it as a .json file. If you need a PDF, the page can export the output for sharing or for attaching to a ticket. Keep in mind that PDF export is formatting-oriented, while JSON export is for machine use.

Local processing and privacy

Conversions are computed in your browser. This page does not upload your text to a server. Uploading a file here simply loads it into your browser so it can be converted on-device. That is useful for quick work with logs and exports that may contain sensitive values.

Best-effort, not magic

Use it to get 80% there fast

If your input is inconsistent, the converter will still aim to produce valid JSON and show what it could not parse. That is the intended workflow: convert, review, adjust the text if needed, and convert again. For complex transforms, a script is still the right tool, but this page can save you time when you just need a clean starting point.

FAQ

Common questions about converting text into JSON and how the output is produced.

It converts plain text into JSON using simple deterministic rules. You can turn one line per item into a JSON array, or parse basic key:value lines into a JSON object.
🔗 Related tools

Other Helpful Tools

A few related projects that pair well with this tool. Fast, focused, and privacy-friendly.