YAML to JSON converter that gets the tricky values right
Kubernetes manifests, CI files and app configs are written in YAML, but some tools, APIs and validators only take JSON. Values like no, on, 1.10 and 08 can quietly change meaning on the way. Your todo.is agent converts the file, expands anchors, splits multi-document files and warns you about values that may not mean what you think.
The prompt
- Convert the attached YAML to JSON: [ATTACH THE YAML]. Expand anchors and aliases (& and *) and merge keys (<<). If the file has several documents separated by ---, [MULTI DOC]. Treat values the way [YAML VERSION] does and list every value that YAML 1.1 and 1.2 would read differently, like yes, no, on, off, version numbers and numbers with leading zeros. Keep key order. Pretty-print with 2 spaces, validate the JSON and send the .json file.
What to change
- [ATTACH THE YAML]: Attach a .yml or .yaml file, or paste it into the chat.
- [MULTI DOC]: E.g. "make a JSON array of documents", "make one JSON file per document" or "there is only one".
- [YAML VERSION]: E.g. "YAML 1.2 (most modern tools)", "YAML 1.1 (older parsers)" or "Kubernetes".
Example result
- YAML to JSON: app-stack.yaml
- 3 documents (Deployment, Service, ConfigMap) · converted to 3 JSON files · YAML 1.2 rules
- Example input
- defaults: &defaults
- replicas: 2
- imagePullPolicy: IfNotPresent
- web:
- <<: *defaults
- replicas: 3
- version: 1.10
- debug: off
- zip: 08012
- Example output
- {
- "defaults": { "replicas": 2, "imagePullPolicy": "IfNotPresent" },
- "web": {
- "replicas": 3,
- "imagePullPolicy": "IfNotPresent",
- "version": 1.1,
- "debug": "off",
- "zip": "08012"
- }
- }
- Values to check
- • version: 1.10 was read as the number 1.1. If you meant the version "1.10", put it in quotes in the YAML
- • debug: off is the string "off" in YAML 1.2 but false in YAML 1.1. Older tools may disagree with newer ones
- • zip: 08012 kept as a string because of the leading zero
- • country: NO (in the ConfigMap) is the string "NO" in 1.2 but false in 1.1, the well-known "Norway problem"
- What was done
- • The anchor &defaults and the merge key << were expanded, so web has every default plus its own replicas
- • Comments were dropped (JSON has no comments)
- • Multi-line strings (| and >) became normal strings with \n line breaks
- • Key order kept as in the YAML
- Files
- deployment.json · service.json · configmap.json, all valid JSON
How to do it with todo.is
- Copy the prompt and say how to handle multi-document files and which YAML version your tool uses.
- Attach or paste the YAML in todo.is, or send it to your agent on Discord or Slack.
- Your agent converts it, expands anchors and lists values that could be read two ways.
- Download the JSON. Ask for the reverse (JSON back to YAML) or a JSON Schema check in the same chat.
Tips for a better result
- Quote anything that must stay text: version numbers, country codes, zip codes and words like yes or no.
- JSON cannot hold comments. If you need them later, keep the YAML as the source file and convert when needed.
- Paste secrets out first. Replace passwords and tokens with placeholders before sharing any config.
- Ask your agent to compare two converted files if you want to see what changed between config versions.
YAML to JSON converter: FAQ
- Is YAML a superset of JSON? YAML 1.2 is designed so that almost any JSON file is also valid YAML. The other way round needs a conversion, because YAML has comments, anchors and multiple documents.
- What is the Norway problem in YAML? In YAML 1.1, unquoted values like NO, yes, on and off become booleans, so the country code NO turns into false. YAML 1.2 reads them as strings, and quoting them avoids the issue in both.
- What happens to YAML comments in JSON? They are removed, since JSON has no comment syntax. Your agent can list them in a note if they matter.
- Can it convert JSON back to YAML? Yes. Ask for it in the same chat and you get a .yaml file with the same data.
JavaScript is required to use the todo.is app.