YAML zu JSON

Konvertiert zwischen den von “YAML zu JSON” definierten Datenrepräsentationen, Formaten oder Einheiten.

Eingabe: TextErgebnis: Strukturiertes JSON

Texteingabe

Ausführen, um das Ergebnis zu sehen

Beispiele

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.

Eingabe

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.

Eingabe

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

Eingabe

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

Expected answer

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

Eingabe

{"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

Eingabe

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

Expected answer

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

Eingabe

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

Expected answer

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

Eingabe

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

Expected answer

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

Eingabe

{"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

Eingabe

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

Expected answer

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

Eingabe

number: 3
plain: string
block: |
  two
  lines

Expected answer

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

Ähnliche Werkzeuge

Datenformat

Referenz zur Operation

Technische Originaldokumentation ansehen (English)