Tool workspace
JSON ↔ YAML Converter
Input
Convert JSON to YAML or YAML to JSON with an online converter. Validate your input, identify parsing errors, adjust indentation and formatting, sort mapping keys, and copy or download the converted result.
Input
Output
Loading tool
Developer Tools
JSON ↔ YAML Converter
Convert JSON to YAML or YAML to JSON with an online converter. Validate your input, identify parsing errors, adjust indentation and formatting, sort mapping keys, and copy or download the converted result.
Quick guide
How to use
Enter your data: Paste JSON or YAML into the input editor, or load the included example.
Choose the conversion direction: Convert JSON to YAML or YAML to JSON.
Adjust formatting: Select the desired YAML indentation or JSON output style.
Review validation: Check the converted result and any parser notices or error messages.
Copy or download: Copy the output, download it as a file, or move it back into the input editor for another conversion.
You can also upload a file or drag and drop it into the tool. With automatic conversion enabled, the result updates as you type.
Details
About this tool
Convert JSON to YAML or YAML to JSON with an online converter. Validate your input, identify parsing errors, adjust indentation and formatting, sort mapping keys, and copy or download the converted result.
What Are JSON and YAML?
JSON and YAML are two commonly used formats for storing and exchanging structured data. Both represent information using objects, arrays, strings, numbers, Boolean values, and other data types, but they use different syntax.
What is JSON?
JSON (JavaScript Object Notation) is a text-based data format commonly used by APIs, web applications, and software systems to exchange structured information.
JSON uses braces, brackets, quotation marks, and commas to organize data.
Example:
{
"name": "Alex",
"age": 30,
"active": true
}
What is YAML?
YAML is a human-readable data serialization format often used for configuration files, application settings, automation workflows, and documentation.
Instead of relying on braces and commas, YAML commonly uses indentation and key-value pairs to represent structured data.
Example:
name: Alex
age: 30
active: true
Why Convert JSON to YAML or YAML to JSON?
Different applications and development tools may expect different data formats. Converting between JSON and YAML helps you reuse structured data without manually rewriting it.
Common use cases include:
Configuration files: Convert JSON settings into YAML for tools and applications that use YAML configuration.
APIs: Change JSON API data into YAML for easier reading or documentation.
Application settings: Move structured settings between systems that support different formats.
Development workflows: Convert sample data when working with software libraries, scripts, and development tools.
Documentation: Present structured data in a format that is easier for readers to understand.
Conversion Examples
Example 1: JSON to YAML
Input JSON:
{
"name": "Alex",
"age": 30,
"active": true,
"skills": ["HTML", "CSS", "JavaScript"]
}
Converted YAML:
name: Alex
age: 30
active: true
skills:
- HTML
- CSS
- JavaScript
Example 2: YAML to JSON
Input YAML:
project: ToolboxShelf
version: 1
settings:
theme: dark
notifications: true
Converted JSON:
{
"project": "ToolboxShelf",
"version": 1,
"settings": {
"theme": "dark",
"notifications": true
}
}
Example 3: Nested data
JSON:
{
"user": {
"name": "Sam",
"location": {
"city": "Berlin",
"country": "Germany"
}
}
}
YAML:
user:
name: Sam
location:
city: Berlin
country: Germany
Both examples represent the same structured data. The syntax and formatting change, but the underlying values and relationships remain the same.
Formatting and Conversion Options
YAML indentation
Choose the indentation level used to display nested YAML data. Indentation controls the visual structure of YAML and must be consistent for the document to be parsed correctly.
JSON output formatting
Choose between formatted JSON, which uses indentation and line breaks for readability, and compact JSON, which removes unnecessary whitespace to produce a shorter representation.
Sort mapping keys
Enable key sorting to arrange mapping keys in a consistent order. This can make configuration files easier to compare and review.
Sorting changes the order in which mapping keys appear in the output. It does not change the intended key-value relationships.
Automatic conversion
Enable automatic conversion to update the output as you edit the input. You can also use manual conversion when you prefer to review your input before processing it.
Validation and Parser Notices
The converter validates input before producing the converted output. If the input cannot be parsed, it reports a readable error message and includes the line and column when available.
For YAML input, the converter uses YAML 1.2 parsing and can flag:
Duplicate keys: Repeated mapping keys that may cause ambiguous or unexpected results.
Multiple YAML documents: Input containing more than one YAML document.
This converter processes one YAML document at a time. If your YAML file contains multiple documents, separate them and convert each document individually.
Parser notices help identify potential issues, but they are not a guarantee that the converted data will work in every application.
Additional Features
Example input: Load sample JSON or YAML to try the converter.
File upload: Select a file or drag and drop it into the input area.
Copy output: Copy the converted data to your clipboard.
Download output: Save the converted result as a file.
Move output to input: Use the current result as the next input for another conversion.
Clear controls: Clear the input and output when starting a new conversion.
Size details: View input and output size information.
Parser notices: Review validation messages and parsing details.
Practical inputs
Examples JSON
Conversion Examples
Example 1: JSON to YAML Input JSON: { "name": "Alex", "age": 30, "active": true, "skills": ["HTML", "CSS", "JavaScript"] } Converted YAML: name: Alex age: 30 active: true skills: - HTML - CSS - JavaScript Example 2: YAML to JSON Input YAML: project: ToolboxShelf version: 1 settings: theme: dark notifications: true Converted JSON: { "project": "ToolboxShelf", "version": 1, "settings": { "theme": "dark", "notifications": true } } Example 3: Nested data JSON: { "user": { "name": "Sam", "location": { "city": "Berlin", "country": "Germany" } } } YAML: user: name: Sam location: city: Berlin country: Germany Both examples represent the same stru
Help
Frequently asked questions
What is the difference between JSON and YAML?
JSON uses braces, brackets, quotation marks, and commas to represent structured data. YAML typically uses indentation and key-value pairs, making it easier for many people to read and edit configuration files.
Can I convert JSON to YAML?
Yes. Paste valid JSON into the input editor, select JSON to YAML, and convert it. The tool produces the equivalent YAML representation.
Can I convert YAML to JSON?
Yes. Paste valid YAML into the input editor, select YAML to JSON, and convert it. The converter uses YAML 1.2 parsing.
Does converting JSON to YAML change the data?
The conversion changes the syntax and formatting, not the intended data structure. However, JSON and YAML have different rules for representing certain values, so you should review the output when working with application-specific data.
Does the converter support multiple YAML documents?
No. The converter handles one YAML document at a time and can flag input containing multiple YAML documents. Separate the documents before converting them individually.
What happens if my JSON or YAML is invalid?
The converter displays a parsing error when available, including the line and column where the problem was detected. Review the message, correct the input, and try again.
What does sorting mapping keys do?
Key sorting arranges mapping keys in a consistent order in the output. It changes their displayed order, not the intended key-value relationships.
Does compact JSON change the data?
No. Compact JSON removes formatting whitespace such as unnecessary spaces and line breaks. It preserves the underlying JSON data.
What does YAML indentation control?
Indentation determines how nested YAML values are visually organized. Consistent indentation is important because YAML uses whitespace to represent structure.
Can I use the converter for configuration files?
Yes. You can convert structured configuration data between JSON and YAML. Always review the converted file before using it in an application, because individual tools may have their own configuration requirements.