Online JSON Converter for YAML, XML, CSV, TOML, JS Object, and PHP Array
Convert valid JSON into YAML, XML, CSV, TOML, JavaScript object literals, and PHP array files directly in the browser. The converter includes format-specific options for CSV tables, XML element names, YAML key ordering, TOML output, and syntax-highlighted preview.
- Converts JSON locally in the browser without uploading input data
- Supports JSON to YAML, XML, CSV, TOML, JS Object, and PHP Array output
- Includes practical controls for CSV flattening, header rows, delimiters, quotes, XML root names, XML item names, attributes, YAML indentation, and sorted keys
- Shows formatted, syntax-highlighted output with copy-ready results
JSON Converter
Convert JSON to YAML, XML, CSV, TOML, JavaScript object literals, and PHP arrays locally with format-specific conversion options.
What this JSON converter does
This page is designed for JSON-first conversion work: paste JSON, choose a target format, adjust the relevant options, and copy the output.
JSON to YAML
Convert JSON objects and arrays into YAML for configuration files, documentation examples, CI settings, and developer-facing snippets. YAML output supports indentation, key sorting, and quoted strings.
JSON to XML
Convert JSON into XML with custom root and item element names. Pretty printing, XML declaration, and attribute mode help match common integration requirements.
JSON to CSV
Convert JSON objects or arrays into CSV tables. Flatten nested objects, include or remove the header row, choose delimiter and quote character, set empty value text, and decide how arrays should be represented.
JSON to TOML
Convert JSON objects into TOML for configuration-oriented workflows. TOML output requires an object root, which matches how TOML files are normally structured.
JSON to JS Object
Turn JSON into a JavaScript object literal style output for examples, fixtures, code snippets, local mocks, and frontend debugging notes.
JSON to PHP Array
Convert JSON into a PHP file that returns an array, useful for PHP configuration samples, fixtures, seed data, and framework examples.
How to convert JSON online
The workflow is intentionally small: paste JSON, choose the output, tune the options that apply to that format, and copy the result.
- 1
Paste a valid JSON object, array, string, number, boolean, or null into the input area.
- 2
Choose YAML, XML, CSV, TOML, JS Object, or PHP Array from the format controls.
- 3
Adjust the options shown for the selected format, such as CSV delimiter, XML root name, or YAML indentation.
- 4
Review the syntax-highlighted output and any error message shown above the result.
- 5
Copy the converted output when it matches the next tool, config file, spreadsheet, or code snippet you need.
Choosing the right output format
Each format keeps a different part of the original JSON shape. Choose the target based on where the converted data will be used next.
- Use YAML when JSON needs to become a readable configuration file or a documentation-friendly example.
- Use XML when an integration, legacy service, document feed, or partner system expects element-based markup.
- Use CSV when the goal is spreadsheet import, quick analysis, BI staging, manual review, or table-based cleanup.
- Use TOML when a tool expects configuration in TOML and the JSON root is an object.
- Use JS Object when the output is meant for JavaScript notes, fixtures, examples, or local mock data.
- Use PHP Array when a PHP project needs array syntax instead of raw JSON.
Common use cases
JSON conversion is common in API debugging, configuration migration, spreadsheet handoff, and cross-tool data preparation.
-
API response conversion
Paste an API JSON response and convert it into YAML, XML, CSV, JS Object, or PHP Array output for debugging, documentation, and test fixtures.
-
Configuration migration
Convert JSON settings into YAML or TOML when moving between tools that use different configuration formats.
-
Spreadsheet preparation
Convert arrays of JSON objects into CSV with delimiter, header, flattening, and array controls before opening the data in Excel, Google Sheets, or an analytics tool.
-
Legacy integration support
Convert JSON payloads into XML when working with services that still require XML documents or XML-style data exchange.
-
Developer examples
Turn JSON into JavaScript object literals or PHP arrays for docs, code comments, local fixtures, framework configuration, and sample data.
-
Data cleanup handoff
Flatten nested JSON into columns before handing the data to a non-developer teammate or importing it into a table-oriented workflow.
-
Fixture and seed data preparation
Prepare JSON-derived samples for frontend mocks, test data, PHP config arrays, and local development files.
-
Format comparison
Quickly compare how the same JSON shape appears as YAML, XML, CSV, TOML, JS Object, and PHP Array before choosing a final format.
Practical conversion guidelines
A clean conversion starts with a clear idea of the destination format and its limits.
When the source is a compressed API response or a log snippet, run it through JSON Formatter first so syntax issues, missing quotes, and uneven nesting are visible before conversion. If the target is a table workflow, send the CSV result to CSV Tools for delimiter checks, column cleanup, filtering, and export.
- Start with valid JSON. If the input is messy or minified, format and validate it before conversion.
- For CSV output, an array of similar objects gives the cleanest table. Mixed object shapes create a wider union of columns.
- Enable flattening when nested objects should become dot-separated CSV columns such as `user.email` or `address.city`.
- Use array expansion only when fixed array positions are meaningful as separate columns; otherwise stringify arrays to preserve their structure in one cell.
- For XML output, choose stable root and item names that match the target API, feed, or document schema.
- For TOML output, keep the root as a JSON object. Root arrays and primitive values are not useful TOML files in this converter.
- Review generated JS Object and PHP Array output before pasting it into a project, especially when strings contain quotes or backslashes.
Limits and important notes
JSON can represent structures that do not map perfectly to table, XML, or configuration formats. These boundaries explain the common surprises.
- CSV is tabular, so nested objects and arrays need flattening, stringifying, or expansion. Some hierarchy is always simplified.
- XML element names are sanitized when JSON keys contain spaces, punctuation, or names that cannot start an XML element safely.
- XML attribute mode only treats keys such as `@id` or `_attr` as attributes. Other keys remain child elements.
- TOML conversion requires an object root and may not represent every possible JSON shape exactly the way a hand-written TOML file would.
- YAML is easier to read than JSON, but whitespace and quoting still matter when the output is used as a real config file.
- Large JSON inputs can make browser-side conversion and syntax highlighting take longer.
Frequently asked questions
Answers to common questions about usage, data handling, result checks, and practical limits.
01 Which JSON conversion formats are supported now?
Which JSON conversion formats are supported now?
The current tool converts JSON to YAML, XML, CSV, TOML, JavaScript object literal output, and PHP array output.
02 Does this JSON converter upload my input?
Does this JSON converter upload my input?
No. Parsing and conversion run in the browser. Your JSON is not sent to a server by this tool.
03 How does JSON to CSV flattening work?
How does JSON to CSV flattening work?
When flattening is enabled, nested keys become dot-separated columns such as `address.city`. When it is disabled, nested objects are kept as JSON strings in cells.
04 What does the CSV array option do?
What does the CSV array option do?
When array expansion is enabled, array items become separate indexed columns. When it is disabled, arrays are stringified into one cell.
05 Can I customize XML output?
Can I customize XML output?
Yes. You can set the root element name, item element name, pretty printing, XML declaration, and attribute mode.
06 Why does TOML conversion require an object root?
Why does TOML conversion require an object root?
TOML files are normally key-value configuration documents, so this converter only accepts JSON objects for TOML output.
07 Is JS Object output valid JSON?
Is JS Object output valid JSON?
No. JS Object output is intended for JavaScript-style code examples and fixtures. Use the original JSON when a strict JSON document is required.
08 Is PHP Array output a full PHP file?
Is PHP Array output a full PHP file?
Yes. The output starts with `<?php` and returns the converted array, so it can be used as a PHP fixture or configuration-style file after review.
More online data tools
Continue browsing data tools for JSON formatting, JSON repair, CSV viewing and cleanup, table conversion, and practical data preparation workflows.