🧠 Built by SuperML.dev · SuperML.org

Having issues with buttons or file uploads? If tools aren't responding, please or press Ctrl+F5 (or Cmd+R on Mac).

← Back to Blog

YAML Formatter & JSON Converter — Format YAML Free in Your Browser

Format and validate YAML, convert YAML to JSON and back. Runs entirely in your browser — your configuration files never leave your device. Free and offline.

YAML is the configuration language of modern infrastructure — Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, and countless application configs. SimpleTools YAML Formatter formats, validates, and converts YAML to/from JSON, entirely in your browser.

What the YAML Formatter Does

Validation: Checks YAML syntax and reports errors with line numbers — a missing colon, incorrect indentation, or invalid YAML construct is caught immediately.

Formatting: Normalises indentation, quote styles, and multi-line string formatting to produce consistent, readable YAML.

YAML → JSON conversion: Convert YAML configuration to equivalent JSON — useful for APIs that accept JSON, for debugging, or for developers more comfortable with JSON.

JSON → YAML conversion: Convert JSON back to YAML — cleaner, more readable for configuration management.

Before and After: YAML Formatting

Before:

apiVersion: apps/v1
kind: Deployment
metadata:
  name:   my-app
  labels:
        app: my-app
spec:
  replicas:    3
  selector:
    matchLabels:
        app: my-app

After formatting:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
  labels:
    app: my-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app

Consistent 2-space indentation, no extra spaces after colons, properly aligned nesting.

YAML Validation Rules

YAML has strict indentation rules and a few common pitfalls:

  1. Indentation matters: YAML uses spaces (not tabs) for structure — mixing causes parse errors
  2. Colon + space: key: value — the space after the colon is required
  3. String quoting: Values starting with special characters ({, [, :, #) need quoting
  4. Multi-line strings: | for literal blocks, > for folded blocks — easy to mix up
  5. Boolean trap: yes, no, on, off, true, false are all YAML booleans — quote them if you mean strings
  6. Tabs forbidden: YAML does not allow tab characters for indentation

Features

  • Syntax validation: Real-time validation with line/column error positions
  • Format/beautify: Consistent indentation and normalised formatting
  • YAML → JSON: Convert YAML to formatted JSON
  • JSON → YAML: Convert JSON to clean YAML
  • Minify YAML: Compact output for embedding in scripts or CLI commands
  • Highlight mode: Syntax highlighting for keys, values, comments, and anchors
  • Anchor/alias support: Handles &anchor and *alias YAML features
  • Multi-document YAML: Handles --- document separators

Why Process Config Files in Your Browser?

YAML configuration files often contain:

  • Database connection strings with credentials
  • API keys and secrets embedded in config
  • Infrastructure topology revealing internal architecture
  • Kubernetes secrets (though these should be managed by a secrets manager)
  • CI/CD pipeline logic revealing deployment processes

Sending these to a cloud-based YAML tool is an unnecessary security risk.

SimpleTools YAML Formatter:

Your YAML never leaves your browser
Works offline — format configs without internet
No account or API key needed
Free for files of any size

How It Works

The tool uses js-yaml — the most widely-used JavaScript YAML parsing library:

import yaml from 'js-yaml';

// Parse YAML to JavaScript object
const parsed = yaml.load(yamlString);

// Convert to JSON
const json = JSON.stringify(parsed, null, 2);

// Convert back to YAML
const reformatted = yaml.dump(parsed, { indent: 2 });

The yaml.load() function validates and parses the YAML. Any syntax error throws an exception with a line/column reference. The yaml.dump() function re-serialises the parsed object to normalised YAML.

How to Use the YAML Formatter

  1. Visit simpletools.one/yaml-formatter
  2. Paste your YAML in the input panel
  3. Validation errors appear immediately in the error panel
  4. Click Format to normalise the YAML
  5. Click → JSON to convert to JSON
  6. Click → YAML (in JSON mode) to convert back to YAML
  7. Click Copy or Download to save the result

Common YAML Errors and Fixes

ErrorLikely CauseFix
bad indentation of a mapping entryInconsistent spacesUse consistent 2-space indentation throughout
unexpected end of the streamUnclosed blockCheck for missing values or incomplete structures
duplicated mapping keySame key twice in an objectRemove or rename the duplicate key
cannot read propertyTabs used for indentationReplace all tabs with spaces (Editor: find \t, replace with )
unexpected tokenSpecial char in unquoted stringQuote the value: key: "value: with colon"

Use Cases

  • Kubernetes YAML: Validate manifests before applying with kubectl apply
  • Docker Compose: Format and validate docker-compose.yml before deploying
  • GitHub Actions: Debug workflow YAML indentation issues
  • Ansible: Validate playbooks and role files
  • Application config: Format and check app config files (config.yaml, settings.yml)
  • API testing: Convert between YAML test data and JSON request bodies

Format and validate your YAML at simpletools.one/yaml-formatter — private, instant, and completely free.

Enjoyed this post?

Subscribe to our newsletter or explore more privacy-friendly tools!

Explore Tools