npm.io
1.0.2 • Published 10 years agoCLI

as-json

Licence
MIT
Version
1.0.2
Deps
0
Vulns
0
Weekly
0
Stars
1

as-json

Returns the stdin in a formatted JSON

Install

npm install -g as-json

Usage example

Imagine you're running a command line and it returns an unformatted json.

Example:

wget -O - -o /dev/null https://raw.githubusercontent.com/Falci/as-json/master/not-formatted-example.json

Returns:

{"simple": "json", "formatted":false}

Now, simply add the | as-json in the flow:

wget -O - -o /dev/null https://raw.githubusercontent.com/Falci/as-json/master/not-formatted-example.json | as-json
{
    "simple": "json",
    "formatted": false
}```