Skip to main content

YAML ↔ JSON converter

Project description

ymljson-cli

A lightweight CLI tool for bidirectional YAML ↔ JSON conversion with optional JSON Schema validation.

Installation

Requires Python >= 3.8.

pip install ymljson-cli

Or from source:

git clone <repo-url>
cd ymljson-cli
pip install .

Usage

The input format (JSON or YAML) is auto-detected, and the output format is the opposite.

ymljson [-h] [-i INPUT] [-o OUTPUT] [--compact] [--schema SCHEMA] [-v]

Options

Flag Description
-i, --input PATH Input file path (default: stdin)
-o, --output PATH Output file path (default: stdout)
--compact Compact output — disables pretty-printing
--schema PATH Path to a JSON Schema file to validate input against
-v, --verbose Enable debug logging

Examples

JSON → YAML (stdin/stdout):

echo '{"name": "Alice", "age": 30}' | ymljson

YAML → JSON from file:

ymljson -i config.yaml -o config.json

Compact JSON output:

ymljson -i data.yaml --compact

With schema validation:

ymljson -i data.yaml --schema schema.json -o data.json

If validation fails, the tool exits with code 2 and logs the error. Any other error exits with code 1.

Dependencies

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ymljson_cli-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ymljson_cli-1.0.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file ymljson_cli-1.0.0.tar.gz.

File metadata

  • Download URL: ymljson_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ymljson_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fd4e87f97dba6d92dda520976247e112b08bd61f3fb31883a8fbaf0135330170
MD5 c5e6a8ee9728761bc2eaaf7b22091724
BLAKE2b-256 7802ff38dc7f6c77b48ab47aea032939b381eb05a5da94d286c9ad8542244252

See more details on using hashes here.

File details

Details for the file ymljson_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ymljson_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ymljson_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de5c8c000484321cd81ecb2da408614bacd882dfbfca7969766aa4f149491a56
MD5 ebcff933113bb737dd413a01eb028c1a
BLAKE2b-256 dbf9075b63f6599c9c4c92546ceca694e5ad54abf03de1ebe0793254f9cfab0d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page