Giter Club home page Giter Club logo

json's Introduction

A "json" command for working with JSON on the command line. It is a single-file node.js script with no external deps (other than node itself). Here is a taste:

$ echo '{"foo":"bar"}' | json
{
  "foo": "bar"
}
$ echo '{"foo":"bar"}' | json foo
bar

Use it to:

  • pretty-print JSON to help read it
  • extract particular values (see LOOKUPS in usage)
  • get details on JSON syntax errors (handy for config files)
  • filter input JSON (see -e and -c options)

Follow @trentmick for updates to jsontool.

See http://trentm.com/json for full docs and many examples.

Installation

  1. Get node.

  2. npm install -g jsontool

OR manually:

  1. Get the 'json' script and put it on your PATH somewhere (it is a single file with no external dependencies). For example:

     cd ~/bin
     curl -L https://github.com/trentm/json/raw/master/lib/jsontool.js > json
     chmod 755 json
    

You should now have "json" on your PATH:

$ json --version
json 3.1.2

Test suite

make test

You can also limit (somewhat) which tests are run with the TEST_ONLY envvar, e.g.:

cd test && TEST_ONLY=executable nodeunit test.js

I test against node 0.4, 0.6, 0.7 and (occassionally) node master.

License

MIT (see the fine LICENSE.txt file).

Command-Line Usage

<something generating JSON on stdout> | json [OPTIONS] [LOOKUPS...]
json -f FILE [OPTIONS] [LOOKUPS...]

See json --help output for full details.

Module Usage

Since v1.3.1 you can use "jsontool" as a node.js module:

var jsontool = require('jsontool');

However, so far the module API isn't that useful and the CLI is the primary focus.

Alternatives you might prefer

json's People

Contributors

fkuo avatar trentm avatar yaniv-aknin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.