jq-hopkok jq utility library

A bunch of jq snippets and shell scripts to manipulate JSON files. See also jqnpm for jq modules/packages.

jq is a lightweight and flexible command-line JSON processor.


⚠️ This project has been archived

No future updates are planned. Feel free to continue using it, but expect no support.


Get it

Just clone the repository.

git clone --recursive git://github.com/joelpurra/jq-hopkok.git

Usage

See README.md each folder, as well as source files. Don’t expect much documentation yet.

$ tree src
src
├── array
│   ├── README.md
│   ├── take.sh
│   ├── to-array.sh
│   └── unwrap-array.sh
├── dynamic
│   ├── README.md
│   └── concat.sh
├── metadata
│   ├── README.md
│   └── structure.sh
├── object
│   ├── README.md
│   ├── as-object.sh
│   ├── merge.sh
│   ├── reduce-merge-deep-add.sh
│   └── sort-object-keys-deep.sh
├── parallelism
│   ├── README.md
│   ├── dataset-foreach.sh
│   ├── dataset-query.sh
│   ├── parallel-chunks.sh
│   └── parallel-n-2.sh
├── tabular
│   ├── README.md
│   ├── array-of-objects-to-csv.sh
│   ├── array-of-objects-to-tsv.sh
│   ├── clean-csv-sorted-header.sh
│   └── clean-tsv-sorted-header.sh
└── url
    ├── README.md
    ├── from-components.sh
    └── to-components.sh

7 directories, 26 files

Original purpose

The library was built awaiting a jq module/package system, but also to collect shell utils for JSON manipulation. Some of these utils can be converted to packages, while others rely on external programs such as the bash shell.

Dependencies

Most utils were written for jq v1.4, and some can be probably be significantly improved with v1.5+ features. When the time comes, the plan is to maintain a branch per jq version for backwards compatibility.

jq-hopkok’s runtime dependencies:

Some utils also use:

See also

  • jqnpm for jq modules/packages.
  • The jq wiki’s cookbook for examples and smart solutions.
  • har-dulcify for the origin of some utils, as well as example usage – especially of the parallelism utils.
  • ep-erroneous-votes for the origin of some utils, and example usage.

TODO

Patches/pull requests welcome!

  • Write tests.
  • Break out jq scripts from shell scripts.
  • Split up files into smaller parts.

License

Copyright (c) 2014, 2015, Joel Purra https://joelpurra.com/ All rights reserved.

When using jq-hopkok, comply to at least one of the three available licenses: BSD, MIT, GPL. Please see the LICENSE file for details.