BairesDev
  1. Tools
  2. JSON2YAML

JSON to YAML

Convert JSON to YAML online

JSON

  • records separated by commas
  • keys & strings wrapped by double quotes
  • good choice for data transport

YAML

Stands for YAML ain't markup language and is a superset of JSON
  • lists begin with a hyphen
  • dependent on whitespace / indentation
  • better suited for configuration than json

JSON

x
38
 
1
{
2
  "json": [
3
    "rigid",
4
    "better for data interchange"
5
  ],
6
  "yaml": [
7
    "slim and flexible",
8
    "better for configuration"
9
  ],
10
  "object": {
11
    "key": "value",
12
    "array": [
13
      {
14
        "null_value": null
15
      },
16
      {
17
        "boolean": true
18
      },
19
      {
20
        "integer": 1
21
      },
22
      {
23
        "alias": "aliases are like variables"
24
      },
25
      {
26
        "alias": "aliases are like variables"
27
      }
28
    ]
29
  },
30
  "paragraph": "Blank lines denote\nparagraph breaks\n",
31
  "content": "Or we\ncan auto\nconvert line breaks\nto save space",
32
  "alias": {
33
    "bar": "baz"
34
  },
35
  "alias_reuse": {
36
    "bar": "baz"
37
  }
38
}

YAML

x
xxxxxxxxxx
1
32
 
1
---
2
# <- yaml supports comments, json does not
3
# did you know you can embed json in yaml?
4
# try uncommenting the next line
5
# { foo: 'bar' }
6
7
json:
8
  - rigid
9
  - better for data interchange
10
yaml:
11
  - slim and flexible
12
  - better for configuration
13
object:
14
  key: value
15
  array:
16
    - null_value: null
17
    - boolean: true
18
    - integer: 1
19
    - alias: aliases are like variables
20
    - alias: aliases are like variables
21
paragraph: |
22
  Blank lines denote
23
  paragraph breaks
24
content: |-
25
  Or we
26
  can auto
27
  convert line breaks
28
  to save space
29
alias:
30
  bar: baz
31
alias_reuse:
32
  bar: baz