JSON to YAML

Convert JSON to YAML or vice versa

Tags: convert code json yaml

Introduction

This is an online converter tool which helps to convert JSON to YAML and vice versa.

How to use this tool?

You can input/paste your code directly into the editor, then click the Convert button. After converting, you can download or save/share the result. It will create a link for you to share with others. You can also sign-in using Google/GitHub to save results into your account.

What is JSON?

JSON (JavaScript Object Notation, pronounced /ˈdʒeɪsən/; also /ˈdʒeɪˌsɒn/) is an open standard file format, and data interchange format, that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types (or any other serializable value). It is a very common data format, with a diverse range of applications, such as serving as a replacement for XML in AJAX systems.

Learn more

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"