JSON to YAML

Convert JSON to YAML or YAML to JSON

Tags: convert code json yaml

Introduction

This online converter tool makes it easy to convert between JSON and YAML formats. Whether you need JSON for APIs or YAML for configuration files, this tool simplifies the process for you.

How to Use This Tool

  1. Paste your code directly into the editor or type it in.
  2. Click the Convert button to switch between JSON and YAML formats.
  3. After the conversion, you can:
    • Download the converted result.
    • Save or share it using a unique link.
    • Sign in with Google or GitHub to save your results for future use.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight, open-standard file format used to store and exchange data. It uses human-readable text to represent data as attribute–value pairs and arrays. JSON is widely used in web applications as a simpler alternative to XML, especially in APIs and AJAX systems.

Its simplicity and versatility make JSON a go-to format for data exchange across various platforms and programming languages.

Learn more about JSON from the official JSON documentation .

JSON Syntax

      
{
  "firstName": "Duke",
  "lastName": "Java",
  "age": 18,
  "streetAddress": "100 Internet Dr",
  "city": "JavaTown",
  "state": "JA",
  "postalCode": "12345",
  "phoneNumbers": [
    {
      "Mobile": "111-111-1111"
    }, {
      "Home": "222-222-2222"
    }
  ]
}
      
    

What is YAML?

YAML (a recursive acronym for "YAML Ain't Markup Language") is a human-readable data-serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted.

YAML targets many of the same communications applications as Extensible Markup Language (XML) but has a minimal syntax which intentionally differs from SGML.[1] It uses both Python-style indentation to indicate nesting, and a more compact format that uses [...] for lists and {...} for maps[1] so that JSON files are valid YAML 1.2

Learn more

      
---
receipt:     Oz-Ware Purchase Invoice
date:        2012-08-06
customer:
    first_name:   Dorothy
    family_name:  Gale

items:
    - part_no:   A4786
      descrip:   Water Bucket (Filled)
      price:     1.47
      quantity:  4

    - part_no:   E1628
      descrip:   High Heeled "Ruby" Slippers
      size:      8
      price:     133.7
      quantity:  1

bill-to:  &id001
    street: |
            123 Tornado Alley
            Suite 16
    city:   East Centerville
    state:  KS

ship-to:  *id001

specialDelivery:  >
    Follow the Yellow Brick
    Road to the Emerald City.
    Pay no attention to the
    man behind the curtain.
...
      
    

Examples

JSON

      
{
  "ProductID": 10440,
  "SKU": "KOI-721",
  "Name": "Basic Beauty Off-The-Shoulder Dress",
  "ProductURL": "https://www.domain.com/product/koi-721",
  "Price": 52,
  "RetailPrice": 78,
  "ThumbnailURL": "https://www.domain.com/images/koi-721_600x600.png",
  "SearchKeywords": "lorem, ipsum, dolor, ...",
  "Description": "Sociosqu facilisis duis ...",
  "ColorSwatches": [
    {
      "color": "Rosewood",
      "family": "Red",
      "price": 42
    },
    {
      "color": "Thyme Green",
      "family": "Green",
      "price": 59.99
    }
  ],
  "DateCreated": "2018-03-03 17:38:50"
}
      
    

YAML

      
---
  ProductID: 10440
  SKU: "KOI-721"
  Name: "Basic Beauty Off-The-Shoulder Dress"
  ProductURL: "https://www.domain.com/product/koi-721"
  Price: 52
  RetailPrice: 78
  ThumbnailURL: "https://www.domain.com/images/koi-721_600x600.png"
  SearchKeywords: "lorem, ipsum, dolor, ..."
  Description: "Sociosqu facilisis duis ..."
  ColorSwatches:
    -
      color: "Rosewood"
      family: "Red"
      price: 42
    -
      color: "Thyme Green"
      family: "Green"
      price: 59.99
  DateCreated: "2018-03-03 17:38:50"