CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
README.md123 linesDownload Raw Back to json
1`json` is a fast CLI tool for working with JSON. It is a single-file node.js2script with no external deps (other than3[node.js](https://github.com/joyent/node) itself). A quick taste:4 5    $ echo '{"foo":"bar"}' | json6    {7      "foo": "bar"8    }9 10    $ echo '{"foo":"bar"}' | json foo11    bar12 13    $ echo '{"fred":{"age":42}}' | json fred.age    # '.' for property access14    4215 16    $ echo '{"age":10}' | json -e 'this.age++'17    {18      "age": 1119    }20 21    # `json -ga` (g == group, a == array) for streaming mode22    $ echo '{"latency":32,"req":"POST /widgets"}23    {"latency":10,"req":"GET /ping"}24    ' | json -gac 'this.latency > 10' req25    POST /widgets26 27Features:28 29- pretty-printing JSON30- natural syntax (like JS code) for extracting particular values31- get details on JSON syntax errors (handy for config files)32- filter input JSON (see `-e` and `-c` options)33- fast stream processing (see `-ga`)34- JSON validation35- in-place file editing36 37See <https://trentm.com/json> for full docs and examples as a man page.38 39Follow <a href="https://twitter.com/intent/user?screen_name=trentmick" target="_blank">@trentmick</a>40for updates to json.41 42 43# Installation44 451. Get [node](http://nodejs.org).46 472. `npm install -g json`48 49   *Note: This used to be called 'jsontool' in the npm registry, but as of50   version 8.0.0 it has taken over the 'json' name. See [npm Package51   Name](#npm-package-name) below.*52 53**OR manually**:54 552. Get the 'json' script and put it on your PATH somewhere (it is a single file56   with no external dependencies). For example:57 58        cd ~/bin59        curl -L https://github.com/trentm/json/raw/master/lib/json.js > json60        chmod 755 json61 62You should now have "json" on your PATH:63 64    $ json --version65    json 9.0.066 67 68**WARNING for Ubuntu/Debian users:** There is a current bug in Debian stable69such that "apt-get install nodejs" installed a `nodejs` binary instead of a70`node` binary. You'll either need to create a symlink for `node`, change the71`json` command's shebang line to "#!/usr/bin/env nodejs" or use72[chrislea's PPA](https://launchpad.net/~chris-lea/+archive/node.js/) as73discussed on [issue #56](https://github.com/trentm/json/issues/56). You can also do "apt-get install nodejs-legacy" to install symlink for `node` with apt.74 75# Test suite76 77    make test78 79You can also limit (somewhat) which tests are run with the `TEST_ONLY` envvar,80e.g.:81 82    cd test && TEST_ONLY=executable nodeunit test.js83 84I test against node 0.4 (less so now), 0.6, 0.8, and 0.10.85 86 87# License88 89MIT (see the fine LICENSE.txt file).90 91 92# Module Usage93 94Since v1.3.1 you can use "json" as a node.js module:95 96    var json = require('json');97 98However, so far the module API isn't that useful and the CLI is the primary99focus.100 101 102# npm Package Name103 104Once upon a time, `json` was a different thing (see [zpoley's json-command105here](https://github.com/zpoley/json-command)), and this module was106called `jsontool` in npm. As of version 8.0.0 of this module, `npm install json`107means this tool.108 109If you see documentation referring to `jsontool`, it is most likely110referring to this module.111 112 113# Alternatives you might prefer114 115- jq: <http://stedolan.github.io/jq/>116- json:select: <http://jsonselect.org/>117- json-command: <https://github.com/zpoley/json-command>118- JSONPath: <http://goessner.net/articles/JsonPath/>, <http://code.google.com/p/jsonpath/wiki/Javascript>119- jsawk: <https://github.com/micha/jsawk>120- jshon: <http://kmkeen.com/jshon/>121- json2: <https://github.com/vi/json2>122- fx: <https://github.com/antonmedv/fx>123 
basant307/AI_Governance_Project · CoolFace