Skip to content

A command-line utility to convert a YAML file (.yml) to JSON file (.json)

License

Notifications You must be signed in to change notification settings

coolaj86/yaml2json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yaml2json

A command-line utility to convert YAML to JSON (meaning a .yml file to a .json file)

The purpose of this utility is to minify YAML as JSON. (ignore the misnomer, YAML is actually an Object Notation, not a Markup Language)

Installation

npm install -g yaml2json

Usage

Specify a file:

yaml2json ./example.yml

json2yaml ./example.json | yaml2json

Or pipe from stdin:

curl -s http://foobar3000.com/echo/echo.json | json2yaml | yaml2json

wget -qO- http://foobar3000.com/echo/echo.json | json2yaml | yaml2json

Example

---
  foo: bar
  baz:
    - qux
    - quxx
  corge: null
  grault: 1
  garply: true
  waldo: "false"
  fred: undefined

becomes

{
  "foo": "bar",
  "baz": [
    "qux",
    "quxx"
  ],
  "corge": null,
  "grault": 1,
  "garply": true,
  "waldo": "false",
  "fred": "undefined"
}

Note: JSON is a proper subset of YAML. The difference is that YAML can use whitespace instead of syntax, which is more human-readable. Also, YAML supports comments.

Alias

yaml2json has the following aliases:

  • yml2json
  • yamltojson
  • ymltojson

About

A command-line utility to convert a YAML file (.yml) to JSON file (.json)

Resources

License

Stars

Watchers

Forks

Packages

No packages published