YAML vers JSON

Convertit entre les représentations de données, formats ou unités définis par “YAML vers JSON”.

Entrée: TexteRésultat: JSON structuré

Saisie de texte

Exécuter pour voir le résultat

Exemples

See exactly how YAML block styles change a build notification

Compare a retained newline, a stripped newline and a folded space in one useful message.

Entrée

clip: |
  Build passed.
strip: |-
  Build passed.
fold: >-
  Build
  passed.

Expected answer

JSON
{
    "clip": "Build passed.\n",
    "strip": "Build passed.",
    "fold": "Build passed."
}
Expand a shared YAML server configuration into JSON

Show the expanded data; JSON does not preserve YAML anchor notation or object-reference syntax.

Entrée

primary: &server
  host: api.example.com
  port: 443
backup: *server

Expected answer

JSON
{
    "primary": {
        "host": "api.example.com",
        "port": 443
    },
    "backup": {
        "host": "api.example.com",
        "port": 443
    }
}
A support ticket with a zero-prefixed identifier

Entrée

{"ticket":"00123","priority":"high"}

Expected answer

JSON
{
    "ticket": "00123",
    "priority": "high"
}
An observatory reading with a negative temperature

Entrée

{"station":"demo-observatory","temperatureC":-12.5,"open":false}

Expected answer

JSON
{
    "station": "demo-observatory",
    "temperatureC": -12.5,
    "open": false
}
A café menu with Unicode and a decimal price

Entrée

{"item":"café","price":3.5,"currency":"EUR"}

Expected answer

JSON
{
    "item": "café",
    "price": 3.5,
    "currency": "EUR"
}
A safe webhook retry policy

Entrée

{"timeoutMs":5000,"retries":2,"enabled":true}

Expected answer

JSON
{
    "timeoutMs": 5000,
    "retries": 2,
    "enabled": true
}
An image manifest with a null caption

Entrée

{"width":640,"height":480,"caption":null}

Expected answer

JSON
{
    "width": 640,
    "height": 480,
    "caption": null
}
A release note with an embedded newline

Entrée

{"version":"2.1.0","notes":"Fixed parser\nAdded tests"}

Expected answer

JSON
{
    "version": "2.1.0",
    "notes": "Fixed parser\nAdded tests"
}
An empty search result

Entrée

{"results":[],"total":0}

Expected answer

JSON
{
    "results": [],
    "total": 0
}
YAML to JSON

Entrée

number: 3
plain: string
block: |
  two
  lines

Expected answer

JSON
{
    "number": 3,
    "plain": "string",
    "block": "two\nlines\n"
}

Outils associés

Format des données

Référence de l’opération

Voir la documentation technique originale (English)