Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
A command-line utility to convert JSON to YAML (meaning a .json
file to a .yml
file)
The purpose of this utility is to pretty-print JSON in the human-readable YAML object notation (ignore the misnomer, YAML is not a Markup Language at all).
npm install -g json2yaml
Note: To use npm
and json2yaml
you must have installed NodeJS.
Specify a file:
json2yaml ./example.json > ./example.yml
yaml2json ./example.yml | json2yaml > ./example.yml
Or pipe from stdin:
curl -s http://foobar3000.com/echo/echo.json | json2yaml
wget -qO- http://foobar3000.com/echo/echo.json | json2yaml
Or require:
(function () {
"use strict";
var YAML = require('json2yaml')
, ymlText
;
ymlText = YAML.stringify({
"foo": "bar"
, "baz": "corge"
});
console.log(ymlText);
}());
So, for all the times you want to turn JSON int YAML (YML):
{ "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: In fact, both of those Object Notations qualify as YAML because JSON technically is a proper subset of YAML. That is to say that all proper YAML parsers parse proper JSON.
YAML can use either whitespace and dashes or brackets and commas.
For human readability, the whitespace-based YAML is preferrable. For compression and computer readability, the JSON syntax of YAML is preferrable.
json2yaml
has the following aliases:
jsontoyaml
json2yml
jsontoyml
FAQs
A commandline utility to convert JSON to YAML / YML
The npm package json2yaml receives a total of 27,099 weekly downloads. As such, json2yaml popularity was classified as popular.
We found that json2yaml demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.