Skip to main content

`jsontool` is utility to fighting with JSON files using CLI

Project description

jsontool
========

`jsontool` is utility to fighting with JSON files using CLI

Current stable version
----------------------

0.2.1

How to use it
-------------

cat data1.json data2.json | jsontool --sort-by='timestamp'

jsontool --color=always < data.json | less -R

More
----

% jsontool -h
usage: jsontool [-h] [-f SORT_BY] [-r] [-g GREP] [-v] [--sort-keys]
[--indent INDENT] [--color {auto,always,never}]

optional arguments:
-h, --help show this help message and exit
-f SORT_BY, --sort-by SORT_BY
sort given list of JSONs by this field
-r, --sort-reversed sort in reverse order
-g GREP, --grep GREP filter list of JSONs using this rules (can be added
more then once)
-v, --version show version and exit
--sort-keys sort keys in printed JSONs (default: not sorted)
--indent INDENT indent JSONs with INDENT spaces
--color {auto,always,never}
manipulate colorizing of JSONs (default: auto)

Argument to --grep option should be in format:
field:value:modifier
Where:
- "field" must be in all JSONs.
- "value" is value to search
- "modifier" is optional, and say how to treat "value": allowed
options are: s (string - default), b (boolean), i (integer), f (float)

Installation
------------

`jsontool` should work on any platform where [Python](http://python.org) is available, it means Linux, Windows, MacOS X etc. There is no required dependencies, plain Python power :)

To install, simply use `pip`:

pip install jsontool

If you do not want to use `pip` tool, then go to [GitHub releases](https://github.com/mysz/jsontool/releases), download newest release, unpack and put somewhere in `PATH` (ie. `~/bin` or `/usr/local/bin`).

If You want to install newest unstable version, then just copy file to your PATH, for example:

curl https://raw.github.com/mysz/jsontool/master/jsontool.py > /usr/local/bin/jsontool

or:

wget https://raw.github.com/mysz/jsontool/master/jsontool.py -O /usr/local/bin/jsontool

Voila!

Authors
-------

Marcin Sztolcman <marcin@urzenia.net>

Contact
-------

If you like or dislike this software, please do not hesitate to tell me about this me via email (marcin@urzenia.net).

If you find bug or have an idea to enhance this tool, please use GitHub's [issues](https://github.com/mysz/jsontool/issues).

License
-------

The MIT License (MIT)

Copyright (c) 2014 Marcin Sztolcman

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ChangeLog
---------

### v0.2.0

* renamed --field argument to --sort-by
* more formatting options (--sort-keys, --indent)
* allow to disable colorizing
* allow to not sort at all
* allow to sort reversed
* documentation and help added

### v0.1.0

* initial version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsontool-0.2.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

jsontool-0.2.1-py2.py3-none-any.whl (8.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file jsontool-0.2.1.tar.gz.

File metadata

  • Download URL: jsontool-0.2.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jsontool-0.2.1.tar.gz
Algorithm Hash digest
SHA256 efd31350f842f5139ce062768ed7faeed0df8636c5688d0b961e848978a9252f
MD5 933f6adf96b2d794cc0182f6ea8c10d1
BLAKE2b-256 8ed2edbeaf269e54a45f14fb61f5beeb962700a375f9d858fcdb06b07796b2c1

See more details on using hashes here.

File details

Details for the file jsontool-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for jsontool-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 42c49ea0d3abc1d173725f6e3e181b7c9c8c5c0098a4680701b05e0f2c7334ec
MD5 9b337da49c26575f7fa41df3b0616bf7
BLAKE2b-256 f3ebc22e08278629dd84e368402f81fed31054e625fd3ab89727409c2a4e308a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page