home / skills / aidotnet / moyucode / json-yaml-converter
This skill converts between JSON, YAML, and TOML, validates and formats configuration files to ensure consistency and readability.
npx playbooks add skill aidotnet/moyucode --skill json-yaml-converterReview the files below or copy the command above to add this skill to your agents.
---
name: json-yaml-converter
description: 在JSON、YAML和TOML格式之间转换,验证和格式化配置文件。
metadata:
short-description: 转换JSON/YAML/TOML格式
source:
repository: https://github.com/yaml/pyyaml
license: MIT
---
# JSON/YAML Converter Tool
## Description
Convert between JSON, YAML, and TOML formats with validation and formatting.
## Trigger
- `/convert-config` command
- User requests format conversion
- User needs to validate JSON/YAML
## Usage
```bash
# Convert JSON to YAML
python scripts/json_yaml_converter.py convert --input config.json --output config.yaml
# Convert YAML to JSON
python scripts/json_yaml_converter.py convert --input config.yaml --output config.json
# Validate file
python scripts/json_yaml_converter.py validate --input config.yaml
# Format/prettify
python scripts/json_yaml_converter.py format --input config.json --indent 2
```
## Tags
`json`, `yaml`, `toml`, `config`, `convert`
## Compatibility
- Codex: ✅
- Claude Code: ✅
This skill converts configuration files between JSON, YAML, and TOML, and offers validation and formatting (prettify) utilities. It streamlines config workflows by ensuring syntactic correctness and consistent indentation across formats. Use it to quickly transform files for different tools or to validate user-provided configs before deployment.
The tool accepts an input file and target format, parses the source using robust parsers for JSON, YAML, and TOML, then serializes the data into the requested format while preserving structure and basic types. It also supports standalone validation to detect syntax errors and a formatting option to apply consistent indentation and style. Commands can be run via a CLI trigger to convert, validate, or prettify files.
Will data types always remain identical after conversion?
Most basic types (strings, numbers, booleans, arrays, objects) are preserved, but some formats handle dates, binary, or null values differently—inspect sensitive fields after conversion.
Can I set indentation or style options?
Yes, the formatter accepts indentation settings (for example, --indent 2) so you can enforce project style conventions.