Converting a Kubernetes manifest for a tool that wants JSON
kubectl accepts both, but many admission controllers, policy engines and diff tools operate on JSON. Converting keeps one source of truth in YAML.
Converts between YAML and JSON, two common configuration and data formats.
Converts between YAML and JSON, two common configuration and data formats.
name: yas port: 3000
{"name":"yas","port":3000}YAML mappings become JSON objects; scalars keep their inferred types.
The output is a faithful structural conversion; type inference follows YAML's rules.
Your input is sent to YAS infrastructure because the tool requires server-side processing or public network queries. Input is not stored.
curl -X POST "https://yas.sh/api/v1/tools/yaml-json" \
-H "Content-Type: application/json" \
-d '{"input":"name: Jane\nage: 30","mode":"to-json"}'const res = await fetch("https://yas.sh/api/v1/tools/yaml-json", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"input": "name: Jane\nage: 30",
"mode": "to-json"
}),
});
const data = await res.json();import requests
r = requests.post("https://yas.sh/api/v1/tools/yaml-json", json={"input":"name: Jane\nage: 30","mode":"to-json"})
data = r.json()| Field | Type | Required | Description |
|---|---|---|---|
| input | string | Yes | YAML or JSON text |
| mode | string | No (default to-json) | to-json | to-yaml |
{ "result": { "name": "Jane", "age": 30 }, "mode": "to-json" }Convert between YAML and JSON (mode: to-json | to-yaml).
400 VALIDATION_ERROR — invalid input or unsupported option.413 PAYLOAD_TOO_LARGE — input exceeds the 64 KB limit.429 RATE_LIMIT_EXCEEDED — rate limit exceeded (60 req/min).YAML is a superset of JSON, so every JSON document is already valid YAML and converting JSON to YAML is a re-serialization into block style. The other direction resolves YAML's additional features — anchors and aliases, multi-document streams, block scalars, implicit typing — down to the plain object, array, string, number, boolean and null vocabulary that JSON supports.
Implicit typing is where YAML surprises people. An unquoted scalar is type-inferred: yes, no, on and off become booleans in YAML 1.1 parsers, a bare 09 may be rejected or read as a string, and a value like 1.0 becomes a float. The Norway problem — the country code NO parsing as boolean false — is the canonical example, and it is why configuration values that must be strings should be quoted.
kubectl accepts both, but many admission controllers, policy engines and diff tools operate on JSON. Converting keeps one source of truth in YAML.
GitHub Actions and GitLab CI files fail on indentation and implicit typing. Seeing the JSON equivalent shows exactly what the parser understood, which is rarely what the indentation suggested.
Anchors keep YAML DRY but make it harder to read. Converting expands them into the concrete structure they produce.
Take a JSON payload and emit YAML for a config file or a documentation example, without hand-indenting nested structures.
What this tool deliberately does not do, and where it will disagree with other implementations.