YAML Editor
View, edit, and format YAML data with syntax highlighting and save formatted YAML to file
This tool helps you edit, format, and visualize YAML data with syntax highlighting and validation.
YAML Editor
Loading...
About YAML
YAML (YAML Ain't Markup Language) is a human-friendly data serialization standard for all programming languages.
Key features of YAML:
- Readable syntax: YAML is designed to be easy for humans to read and write.
- Hierarchical structure: YAML uses indentation to represent structure, making it ideal for configuration files.
- Widely supported: YAML is supported by many programming languages and tools.
- Flexible data types: Supports scalars, lists, and associative arrays (maps).
This tool helps you work with YAML data client-side, with all processing happening in your browser for privacy and security.
YAML Format Examples
Here's an example of a YAML object representing a person:
person:
name: John Doe
age: 30
isActive: true
address:
street: 123 Main St
city: Anytown
zipCode: 12345
phoneNumbers:
- type: home
number: 555-1234
- type: work
number: 555-5678
Common YAML data types:
- String:
name: "John"
- Number:
age: 30
- Boolean:
isActive: true
- Object:
address: { city: Anytown }
- Array:
tags: [developer, designer]
- Null:
middleName: null
Using YAML in Different Languages
Here are examples of how to work with YAML in different programming languages:
JavaScript (js-yaml):
const yaml = require('js-yaml');
const obj = yaml.load(yamlString);
const yamlStr = yaml.dump(obj);
Python (PyYAML):
import yaml
obj = yaml.safe_load(yaml_string)
yaml_str = yaml.dump(obj)
Go (gopkg.in/yaml.v3):
import "gopkg.in/yaml.v3"
var obj map[string]interface{}
yaml.Unmarshal([]byte(yamlString), &obj)
data, _ := yaml.Marshal(obj)