# YAML JSON Converter
Pure-stdlib YAML <-> JSON converter and validator (no PyYAML).
```
python scripts/run.py yaml2json config.yaml
python scripts/run.py json2yaml data.json
python scripts/run.py validate config.yaml
echo '{"a":{"b":[1,2]}}' | python scripts/run.py json2yaml -
```
Implements a minimal YAML emitter/parser covering nested dicts, lists, strings,
numbers, booleans and null.
---
name: yaml-json-converter
display_name: YAML JSON Converter
description: "Convert between YAML and JSON and validate YAML, using a pure-stdlib YAML engine (no PyYAML). Triggers: yaml to json, json to yaml, convert yaml, validate yaml, parse yaml."
---
# YAML JSON Converter
Convert between YAML and JSON and validate YAML — zero third-party dependencies.
## When to use
The user pastes YAML or JSON (or a `.yaml`/`.json` file) and wants it converted
to the other format, or wants to confirm some YAML parses cleanly.
## How to use
Run `scripts/run.py` with a mode:
- `python scripts/run.py yaml2json config.yaml` — YAML -> pretty JSON.
- `python scripts/run.py json2yaml data.json` — JSON -> YAML.
- `python scripts/run.py validate config.yaml` — parse-check; prints `valid YAML` or an error.
Read from stdin with `-`, e.g. `cat config.yaml | python scripts/run.py yaml2json -`.
## Pitfalls
- The engine supports nested maps/lists and scalars (string, int, float, bool,
null) — the common config subset. It does NOT handle anchors/aliases,
multi-document streams (`---`), block scalars (`|` / `>`), or tags.
- Bare values like `yes`, `on`, `null` are interpreted as YAML keywords; quote
them to keep them as strings.
- Indentation must be spaces (YAML forbids tabs).
YAML JSON Converter by langbot-team
Convert between YAML and JSON and validate YAML, using a pure-stdlib YAML engine (no PyYAML).
Loading...