Welcome to jx, a powerful command-line tool for JSON processing! Developed by TwoBitCoders, jx fuses the memory-safety and performance of Go with the flexibility of JavaScript syntax. Unlike other tools like jq that require learning a new domain-specific language, jx allows you to use your existing JavaScript knowledge to handle JSON with ease.
- JavaScript Syntax: Use familiar JavaScript constructs to filter, transform, and manipulate JSON data.
- Memory Safe: Built in Go, ensuring fast and secure processing, even with large datasets.
- Cross-Platform: Seamlessly runs on Linux, macOS, and Windows thanks to Go's portability.
- High Performance: Comparable to jq, but with the safety and simplicity of Go and JavaScript.
- Single-binary install: It's just a single binary, put it somewhere on your path, mark it executable and your good to go
jx is your ultimate tool for JSON manipulation. Whether you're working with APIs, logs, or configuration files, jx provides an intuitive, command-line experience without sacrificing performance or security. With the power of Go and the flexibility of JavaScript, it’s ideal for developers who want to avoid learning a new syntax while gaining the safety of a memory-safe language.
jx is designed to be fast and user-friendly, eliminating unnecessary complexity from your JSON processing workflows.
- No Learning Curve: Use familiar JavaScript syntax—no need to learn jq's DSL.
- Efficient and Lightweight: Go's compilation speed and memory safety ensure high performance.
- No UI Overhead: Designed to be a lean, CLI-only tool—no unnecessary graphical interface to bloat your workflow.
- Robust and Portable: Works out of the box across multiple platforms.
For standalone installation, you can download the latest release directly from our Releases Page.
To install jx, follow these steps:
- Clone the Repo:
git clone https://github.com/TwoBitCoders/jx
- Build jx:
cd jx go build -o out/
- Run the Simplest Command:
'x' has your parsed JSON in it - so 'jx x' will pretty print your input data.
echo '{"foo":42}' | jx x
Alternatively, download pre-built binaries from our releases page and add them to your PATH
.
jx makes JSON manipulation easy and accessible directly from your terminal.
All examples assume you're using a Bash shell, you are always passed variable 'x', it's value is the result of parsing your JSON.
- Extract a Field:
echo '{"foo":42,"bar":0}' | jx 'x.foo'
- Filter an Array:
echo '[{"foo":42},{"foo":0}]' | jx 'x.filter(item => item.foo !== 0)'
- Transform Data:
echo '[{"foo":21}]' | jx 'x.map(item => ({ bar: item.foo * 2 }))'
- Multiple Statements:
echo '{"foo":21}' | jx '{let op1 = x.foo;let op2 = 2;return op1*op2}'
Note: If you need multiple statements throw braces around your code, turning it into a "block body".
Note: For PowerShell Users on Windows: Set-ExecutionPolicy -ExecutionPolicy Unrestricted
For more detailed examples and advanced usage, check out the Wiki.
We welcome contributions from the community. Here's how you can get involved:
- Submit Issues: Encountered a bug or have a feature request? Open an issue.
- Create Pull Requests: If you want to contribute code, check our contribution guidelines in the
CONTRIBUTING.md
file. - Join Discussions: Discuss features, improvements, or usage questions here.
Love jx? Consider supporting us:
- Become a Sponsor: Help us keep improving jx with your generous support.
- For more tools and projects, visit the TwoBitCoders GitHub page.
jx is licensed under the MIT License. See the LICENSE file for details.
TwoBitCoders: Empowering developers, one tool at a time.