Zero-config YAML ↔ JSON converter. One command, no flags needed.
npx jyml config.yaml # → config.json
npx jyml data.json # → data.yaml
- Zero friction — pass a file, get the converted file. No flags required.
- Predictable — same filename, swapped extension, same directory.
- LLM-ready —
--json structured output, documented exit codes, errors to stderr.
- Tiny — two dependencies, < 4 kB published.
# Global install
npm install -g jyml
# Or run directly
npx jyml config.yaml
| Argument |
Description |
file |
Path to the input file (.yaml, .yml, or .json) |
| Option |
Description |
Default |
-o, --output <path> |
Output file path |
Input file with swapped extension |
--json |
Print structured JSON to stdout (no file written) |
— |
--indent <n> |
Indentation spaces |
2 |
-h, --help |
Show help |
— |
-V, --version |
Show version |
— |
# Convert an OpenAPI spec to JSON for code generators
jyml openapi.yaml
# → writes openapi.json
# Convert ESLint config from JSON to YAML
jyml .eslintrc.json
# → writes .eslintrc.yaml
# Grab a value from a GitHub Actions workflow in a script
jyml .github/workflows/ci.yml --json | jq '.content.jobs'
# Convert docker-compose for a tool that needs JSON
jyml docker-compose.yml -o docker-compose.json
# Convert a JSON API response to readable YAML with wider indent
jyml response.json --indent 4
| Stream |
Content |
| stdout |
Converted file content (only with --json) |
| stderr |
Progress messages, errors, diagnostics |
| file |
Converted output (default mode) |
{
"input": "/absolute/path/to/input.yaml",
"format": "json",
"output": "/absolute/path/to/input.json",
"content": { ... }
}
| Field |
Type |
Description |
input |
string |
Absolute path to the source file |
format |
string |
Output format: "json" or "yaml" |
output |
string |
Path where the file would be written |
content |
object |
The parsed and converted data |
| Code |
Meaning |
0 |
Success |
1 |
Conversion error (invalid YAML/JSON, I/O failure) |
2 |
Invalid usage (missing file, bad arguments, unsupported extension) |
Errors are printed to stderr with actionable context:
Error: File not found: config.yaml
Error: Unsupported file extension ".txt". Supported: .yaml, .yml, .json
Error: Invalid YAML: bad indentation of a mapping entry (1:11)
Error: Invalid JSON: Expected property name or '}' in JSON at position 2
MIT