Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kurtbuilds/jq
https://github.com/kurtbuilds/jq
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kurtbuilds/jq
- Owner: kurtbuilds
- Created: 2022-11-18T17:19:49.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-17T17:41:11.000Z (about 2 months ago)
- Last Synced: 2024-09-18T07:54:22.537Z (about 2 months ago)
- Language: Rust
- Size: 40 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jq
Replacement for `stedolan/jq`. Why?
- `csv` subcommand to succinctly and intuitively convert JSON to CSV
- Handle multiple JSON documents in a single stream. `stedolan/jq` only handles one document at a time.
This feature enables chaining multiple `jq` commands together, eliminating the need for quoting
commands, as is the case with the `stedolan/jq`.# Example
Here's an example that shows chaining of `jq` commands, and the `csv` subcommand.
```bash
cat data/reviews.json | jq feed.entry | jq csv content.label author.name.label > ios-reviews.csv
# Yes, this is an unnecessary use of cat :) It keeps the command order same as stream order.
```# Installation
```bash
cargo install --git https://github.com/kurtbuilds/jq
```### Why did you name it the same as `stedolan/jq`?
It's meant to be a drop-in replacement. Rather than use an alias, I just call the executable the same. On my machine, with `brew install jq`, I have both `jq` commands installed:
```bash
$ which -a jq
~/.cargo/bin/jq
/opt/homebrew/bin/jq
```I use the fully qualified path `/opt/homebrew/bin/jq` if I need the `stedolan/jq` version for some reason.
### Differences compared to `stedolan/jq`
- leading `.` is optional
- bash command chaining works, so we don't have to wrap the command in single quotes `''`
- Just pass keypaths into the `csv` command to generate a csv. No esoteric command syntax.
- Strings are printed `raw` by default, not wrapped in quotes.# Roadmap
- [x] Basic `jq` functionality
- [x] Chained documents
- [x] Csv subcommand
- [x] Colored output# Contributions
Need features? Open an issue or a PR.