A project that productizes the jq-front. jq-front is a simple utility that extends JSON files with file- and node-level inheritance, templating, and reference evaluation, making it easier to create reusable and dynamic JSON-based configurations.
Currently jq++ supports only inheritance features.
This project follows the standard Go project layout.
- Go 1.24.5 or later (see go.mod for the exact version requirement)
- Make (optional, for using the Makefile)
The easiest way to install jqplusplus is using go install:
go install github.com/dakusui/jqplusplus/cmd/jqplusplus@latest
[[ ! -e "$(dirname "$(which jqplusplus)")/jq++" ]] && ln -s "$(which jqplusplus)" "$(dirname "$(which jqplusplus)")/jq++"This will install the jqplusplus binary to $GOPATH/bin or $GOBIN (if set). Make sure this directory is in your PATH.
Clone the repository:
git clone https://github.com/dakusui/jqplusplus.git
cd jqplusplusThen build using Make:
make buildThis will create the executable as bin/jq++.
Alternatively, build directly with Go:
go build -o bin/jq++ ./cmd/jqplusplusAfter building, you can add the bin directory to your PATH, or copy the binary to a directory already in your PATH:
# Option 1: Add bin directory to PATH (add to ~/.bashrc, ~/.zshrc, etc.)
export PATH="$PATH:$(pwd)/bin"
# Option 2: Copy to a directory in PATH (e.g., /usr/local/bin)
sudo cp bin/jq++ /usr/local/bin/Let's prepare files, name.json and greeting.json, from which you want to create a new JSON by extending them.
$ echo '{"yourname":"Mark"}' > name.json
$ cat name.json
{"yourname":"Mark"}
$ echo '{"greeting":"Hello"}' > greeting.json
$ cat greeting.json
{"greeting":"Hello"}Then create a file that extends them.
$ echo '{
"$extends": ["greeting.json", "name.json"],
"sayHello": "eval:$(ref .greeting), $(ref .yourname). Toady is $(date). How are you doing?"
}' > sayHello.jsonNow, let's try jq++.
$ jq++ sayHello.json
{
"yourname": "Mark",
"greeting": "Hello",
"sayHello": "Hello, Mark. Toady is Fri Aug 30 22:04:40 UTC 2019. How are you doing?"
}
$Doesn't it seem useful? Have fun!
cmd/jqplusplus/main.go: Application entry pointinternal/: Private application and library codepkg/: Public libraries (if any)go.mod,LICENSE,README.md,Makefile: Project metadata and configuration
To build the main application:
make buildThis will create the executable as bin/jq++.
To run the program:
./bin/jq++Or run directly without building:
make run