# Text to JSON Converter

Convert various text formats to JSON with customizable parsing options

> Canonical page: https://elysiatools.com/en/tools/text-to-json

- **Category:** Format Conversion

- **Keywords:** text, json, converter, transform, data, parse, format, structured

## Overview

The Text to JSON Converter is a versatile utility designed to transform unstructured or semi-structured text data into clean, valid JSON format. Whether you are working with CSV files, key-value pairs, or custom delimited text, this tool provides precise control over parsing, structure, and formatting to streamline your data integration workflows.

## Inputs

- **Text Input** (textarea): Enter your text data to convert to JSON: name,age,city John,25,New York Jane,30,London Or paste JSON, key-value pairs, INI format, etc...
- **Input Format** (select)
- **Custom Delimiter** (text): Custom delimiter (e.g., |, ;, \t)
- **Output Structure** (select)
- **Root Key Name** (text): Root object key (optional)
- **Force Array Output** (checkbox)
- **Trim Whitespace** (checkbox)
- **Skip Empty Lines** (checkbox)
- **Pretty Print JSON** (checkbox)
- **Include Metadata** (checkbox)

## When to use

- Converting legacy data formats like CSV, TSV, or INI into modern JSON structures for web applications.
- Cleaning up raw text logs or key-value pairs into a standardized, machine-readable format.
- Preparing structured data for API payloads or configuration files by applying custom delimiters and nesting options.

## How it works

- Paste your raw text data into the input area and select the appropriate input format, or use auto-detection.
- Configure your parsing preferences, such as custom delimiters, whitespace trimming, and empty line handling.
- Choose your desired output structure, such as an array of objects or a nested object, and enable pretty-print for readability.
- Generate and copy your formatted JSON output instantly.

## Use cases

- Transforming spreadsheet exports (CSV) into JSON arrays for frontend data binding.
- Converting server configuration files (INI) into JSON for easier management in cloud environments.
- Parsing raw log lines into structured JSON objects for easier analysis and filtering.

## Frequently asked questions

### What input formats are supported?

The tool supports CSV, TSV, PSV, SSV, custom delimiters, JSON, key-value pairs, INI format, and line-based text.

### Can I define my own delimiter?

Yes, select 'Custom Delimiter' from the input format options and enter your specific character or string in the delimiter field.

### Does the tool handle whitespace automatically?

Yes, the 'Trim Whitespace' option is enabled by default to ensure your JSON keys and values are clean and free of unnecessary padding.

### Can I output the data as a single nested object?

Yes, you can select 'Nested Structure' or 'Object with Keys' under the Output Structure settings to change how the data is mapped.

### Is the output JSON minified or formatted?

You can toggle the 'Pretty Print JSON' option to switch between a compact, minified format and a human-readable, indented format.

## Related tools

- [XML to JSON Converter](https://elysiatools.com/en/tools/xml-to-json): Convert XML data to JSON format with customizable parsing options
- [BSON Converter](https://elysiatools.com/en/tools/bson-converter): Encode and decode data to/from BSON (Binary JSON) format
- [HCL-JSON Converter](https://elysiatools.com/en/tools/hcl-json-converter): Convert between HashiCorp Configuration Language (HCL) and JSON formats for Terraform configurations
- [Netrc Parser](https://elysiatools.com/en/tools/netrc-parser): Parse and convert Netrc file format to JSON
- [Smile Converter](https://elysiatools.com/en/tools/smile-converter): Encode and decode data to/from Smile (binary JSON) format
- [SSH Config Parser](https://elysiatools.com/en/tools/ssh-config-parser): Parse and convert SSH configuration file to JSON format
- [Text to Excel Converter](https://elysiatools.com/en/tools/text-to-excel): Convert various text formats to Excel with customizable parsing and formatting options
- [TOML-JSON Converter](https://elysiatools.com/en/tools/toml-json-converter): Convert between TOML and JSON formats with support for comments and complex data structures

## Samples

- [Rich Media JSON Samples](https://elysiatools.com/en/samples/rich-media-json): JSON examples for popular rich text editors (TipTap, Quill, Slate)
- [JSON Samples](https://elysiatools.com/en/samples/json): JSON (JavaScript Object Notation) format examples from simple to complex structures
- [Chat Transcript JSON Samples](https://elysiatools.com/en/samples/chat-transcript-json): JSON examples for multi-role chat transcripts
- [Terraform Plan JSON Samples](https://elysiatools.com/en/samples/terraform-plan-json-samples): Sample Terraform plan JSON files exported from terraform show -json style payloads for dependency visualization and change review

## Related content

- [Semi-Structured Text Parsing and Table Extraction Tools](https://elysiatools.com/en/hubs/semi-structured-text-table-extraction): Turn fixed-width text, mixed-delimiter records, logs, and HTML or Markdown tables into clean CSV, JSON, XML, or Excel outputs with focused parsing and repair tools.
- [JSON Interchange and Format Translation Tools](https://elysiatools.com/en/hubs/json-convert): Compare JSON conversion tools for CSV, YAML, TOML, GraphQL, XML, Markdown, Excel, BSON, EDN, and related structured formats in one hub.
- [Text Case, Encoding, and Normalization Conversion Tools](https://elysiatools.com/en/hubs/text-convert): Compare text case conversion, character-width conversion, encoding conversion, quoted-printable handling, and inline text normalization tools in one hub.
- [JSON Inspection, Diff, and Transformation Tools](https://elysiatools.com/en/hubs/json-utility): Compare JSON formatting, diffing, path inspection, schema validation, merging, transformation, and export tools in one hub for API and data workflows.
