#grep #json

app ripjson

A fast and lean way to grep in JSON files

12 releases

0.9.11 Oct 26, 2023
0.9.10 Jul 20, 2023
0.9.9 Feb 7, 2023
0.9.8 Jun 28, 2022
0.9.5 Mar 29, 2019

#3 in #london

Download history 6/week @ 2023-11-03 2/week @ 2023-11-10 2/week @ 2023-11-17 15/week @ 2023-11-24 50/week @ 2023-12-01 13/week @ 2023-12-15 24/week @ 2023-12-22 12/week @ 2023-12-29 1/week @ 2024-01-05 1/week @ 2024-01-12 10/week @ 2024-01-19 13/week @ 2024-01-26 13/week @ 2024-02-02 19/week @ 2024-02-09 150/week @ 2024-02-16

195 downloads per month

MIT license

10KB
191 lines

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"

Dependencies

~4–15MB
~159K SLoC