ripjson

Crates.ioripjson
lib.rsripjson
version0.9.11
sourcesrc
created_at2019-03-27 19:39:10.956121
updated_at2023-10-26 14:16:24.817835
descriptionA fast and lean way to grep in JSON files.
homepagehttps://github.com/matthiasdiener/ripjson
repositoryhttps://github.com/matthiasdiener/ripjson
max_upload_size
id124224
size23,468
Matthias Diener (matthiasdiener)

documentation

https://github.com/matthiasdiener/ripjson

README

ripjson

A fast and lean way to grep in JSON files.

Installation

$ cargo install ripjson

Usage

Usage: rj <regex> <files> [options]

Options:
    -i, --ignore-case   Search case insensitively.
    -s, --sensitive-case
                        Search case sensitively [default].
    -h, --help          Print this help menu.
    -v, --version       Print version.
        --color <WHEN>  Color output.
                        WHEN can be never, always, or auto [default].

Prints all JSON keys and values in <files> whose keys match <regex>.

<regex> specifies for which JSON keys to search for. Separate path elements with a /, e.g. user/name, similar to the JSON pointer syntax specfied in https://tools.ietf.org/html/rfc6901.

Example

$ cat test.json
{
    "name": "John Doe",
    "age": 43,
    "address": {
        "street": "10 Downing Street",
        "city": "London"
    },
    "phones": [
        "+44 1234567",
        "+44 2345678"
    ]
}

$ rj '.*es.*' test.json
address/street = "10 Downing Street"
address/city = "London"
phones = "+44 1234567"
phones = "+44 2345678"

$ rj '.*es.*/cit' test.json
address/city = "London"
Commit count: 22

cargo fmt