JSON to YAML Converter

Format a JSON object into YAML

Input: TextResult: Text

Text input

Run to see the result

Examples

Convert the RFC 8259 image metadata object

Input

{"Image":{"Width":800,"Height":600,"Title":"View from 15th Floor","Thumbnail":{"Url":"http://www.example.com/image/481989943","Height":125,"Width":100},"Animated":false,"IDs":[116,943,234,38793]}}

Expected answer

Image:
  Width: 800
  Height: 600
  Title: View from 15th Floor
  Thumbnail:
    Url: http://www.example.com/image/481989943
    Height: 125
    Width: 100
  Animated: false
  IDs:
    - 116
    - 943
    - 234
    - 38793
Convert a GeoJSON feature without reversing its coordinates

Coordinates remain longitude, latitude: 102, 0.5.

Input

{"type":"Feature","geometry":{"type":"Point","coordinates":[102.0,0.5]},"properties":{"prop0":"value0"}}

Expected answer

type: Feature
geometry:
  type: Point
  coordinates:
    - 102.0
    - 0.5
properties:
  prop0: value0
Make a nested deployment configuration readable

Input

{"service":"image-resizer","replicas":2,"ports":[8080,9090],"health":{"path":"/ready","timeoutSeconds":3}}

Expected answer

service: image-resizer
replicas: 2
ports:
  - 8080
  - 9090
health:
  path: /ready
  timeoutSeconds: 3
Keep strings that look like numbers or null as strings

00123, null and the empty value are strings here; missing is a real null.

Input

{"postalCode":"00123","literalNull":"null","empty":"","enabled":false,"retries":3,"missing":null}

Expected answer

postalCode: '00123'
literalNull: 'null'
empty: ''
enabled: false
retries: 3
missing: null
Convert an ordered shopping list with repeated item names

Input

[{"item":"coffee","grams":250},{"item":"coffee","grams":500},{"item":"tea","grams":100}]

Expected answer

- item: coffee
  grams: 250
- item: coffee
  grams: 500
- item: tea
  grams: 100
Convert a 64-bit identifier without rounding

Input

{"id":18446744073709551615}

Expected answer

id: 18446744073709551615
Keep every digit of a decimal amount

Input

{"amount":12345678901234567890.123456789}

Expected answer

amount: 12345678901234567890.123456789
JSON to YAML

Input

{ "number": 3, "plain": "string" }

Expected answer

number: 3
plain: string

Format reference: JSON to YAML background and specification

Related tools

Browse data format tools