Skip to content

yannoff/jaml

Repository files navigation

JAML

Easy-to-use JSON <=> YAML converter

Latest stable release MIT License

Usage

Input format is detected automatically, hence:

Converting YAML to JSON

# The classic way:
jaml <file.yaml|url-to-yaml-contents>

# or using piped standard input:
cat file.yaml | jaml

Converting JSON to YAML

# The classic way:
jaml <file.json|url-to-json-contents>

# or using piped standard input:
cat file.json | jaml

Examples

Converting remote JSON contents over https

jaml https://repo.packagist.org/packages/list.json?vendor=yannoff

Output:

packageNames:
    - yannoff/collections
    - yannoff/composer-dotenv-handler
    - yannoff/console
    - yannoff/handyman
    - yannoff/lumiere-ui
    - yannoff/lumiere-utils
    - yannoff/symfony-boilerplate
    - yannoff/y-a-m-l
    - yannoff/yamltools

Converting a YAML file contents

jaml composer.yaml

Output:

{
    "name": "yannoff/jaml",
    "description": "Easy-to-use JSON <=> YAML converter",
    "type": "project",
    "license": "MIT",
    "authors": [
        {
            "name": "Yannoff",
            "homepage": "https://github.com/yannoff"
        }
    ],
    "autoload": {
        "psr-4": {
            "Yannoff\\Jaml\\": "src/"
        }
    },
    "require": {
        "yannoff/console": "^2.0",
        "yannoff/yamltools": "^1.5"
    }
}

Available options

-i, --interactive

Run in interactive mode

-h, --help

Display help message

-v, --verbose

Increase the verbosity of jaml output

--version

Display version and exit

Installation

Requirements

Quick install

Get the latest release and install it

curl -Lo /usr/bin/jaml https://github.com/yannoff/jaml/releases/latest/download/jaml
chmod +x /usr/bin/jaml

💡 The /usr/bin/jaml path is just an example, fell free to replace by any custom binary file path.

Checksums

Some checksum files are available to verify the jaml binary integrity:

Here is an example using PHP

echo hash_file('sha384', 'https://github.com/yannoff/jaml/releases/latest/download/jaml');

Credits

JAML leverages offenbach for PHP dependency management.

Compiled as a PHAR self-executable using PHP Code Compiler.

License

Licensed under the MIT License.