
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
json-command
Advanced tools
JSON command line processing toolkit.
no more writing code to inspect or transform JSON objects.
this npm module includes a json shell command. the json command processes standard input and parses json objects. json currently handles a few different standard input formats and provides a number of options tailored toward inspecting and transforming the parsed json objects.
json-command has been renamed to json in npm. all updates will be made to the json npm package.
you need node v0.4.0 or higher and npm to run this program.
npm install json
installs json shell command.
the following examples parse json output from twitter http requests and output the requested json fields.
please note that the last two examples require you to enter your username and password.
curl http://search.twitter.com/search.json?q=node.js
curl -s http://search.twitter.com/search.json?q=node.js | json
curl -s http://search.twitter.com/search.json?q=node.js | json -o results
curl -s http://search.twitter.com/search.json?q=node.js | json -o results from_user metadata
curl -s http://search.twitter.com/search.json?q=node.js | json -o results new_id=id
curl -s http://search.twitter.com/search.json?q=node.js | json -o results -C from_user from_user_id
curl -s http://stream.twitter.com/1/statuses/sample.json -uAnyTwitterUser:Password | json user.name user.id
curl -s http://stream.twitter.com/1/statuses/sample.json -uAnyTwitterUser:Password | json user.name user.id -c "entities.user_mentions.length > 0"
json [options] [fields]
-h print help info and exit
-v (-V | --version) print version number and exit
-u print ugly json output, each object on a single line
-d print debugging output including exception messages
-o object.path specify the path to an array to be iterated on
new.key=old_key move old_key to new.key in output object
-a input object is an array, process each element separately
-c "js conditional" js conditional to be run in the context of each object that determines whether an object is printed
-C print the output fields as tab delimited columns in the order specified by fields
-e "js expression" execute arbitrary js in the context of each object.
-i use node's util.inspect instead of JSON.stringify.
-H print headers, if they are supplied. Useful for output from curl -i.
any number of fields can be specified to be printed from each json object. by default the structure of the original json object is maintained, however options like -e and foo=bar allow for transforming object structure.
to remove a particular key, assign it to undefined using the -e flag.
objects are parsed from stdin
any non-existing requested keys are instantiated
key transforms are applied to the object
expressions are run against the object
conditionals are checked against the object. the object is discarded if conditionals do not pass
the requested keys are pulled from the object and output
the npm package includes a man page that can be accessed using:
man json
this is alpha quality code, so use at your own risk.
this project respectfully uses code from and thanks the authors of:
FAQs
JSON command line processing toolkit.
The npm package json-command receives a total of 1 weekly downloads. As such, json-command popularity was classified as not popular.
We found that json-command 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
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.