Crates.io | livejq |
lib.rs | livejq |
version | 2.0.0 |
source | src |
created_at | 2023-07-30 13:48:40.347686 |
updated_at | 2024-08-04 08:39:00.722616 |
description | An alternative jq implementation in rust for continuous parsing without crashing on invalid JSON. With filters |
homepage | https://github.com/kunalsin9h/livejq |
repository | https://github.com/kunalsin9h/livejq |
max_upload_size | |
id | 929985 |
size | 25,985 |
livejq
is JSON parser like jq
but is designed to work in continuous input without crashing on invalid JSON. With json filtering.
It uses livejq.toml
file to specify filter rules.
When you have a program that is printing logs which may have other formats in between like text along with JSON, and you want to parse JSON for better readability. You can use livejq
to parse JSON without crashing on other formats.
Or when you want to apply filters
when paring json.
https://github.com/KunalSin9h/livejq/assets/82411321/71907858-5150-4efe-8c0f-58bb1c0dc591
Install using cargo
cargo install livejq
binaries
in the Release page./your_program | livejq
To apply filtering, you need to create livejq.toml
file in the project root.
It contains labels
. labels are filter labels which you can apply with -f
/ --filter
flag.
Example config file:
# livejq.toml
allow = ["name"] # default
[network-fail] # -f network-fail
allow = ["failed"]
[memory-info] # -f memory-info
allow = ["memory"]
Then run the application as
./your_program | livejq -f network-fail
# you can apply multiple filters
./your_program | livejq -f network-fail memory-info
when not label
is created, default
is used. For each label, you can only give allow or disallow, not both.
When not flag
is used while running the program, the default
flag is used.
Here
|
is for piping output ofmy_program
intolivejq
as input.