Edit .json.gz Files Effortlessly with jgze – A Flexible CLI Tool

teihenn

yyossy

Posted on November 17, 2024

Edit .json.gz Files Effortlessly with jgze – A Flexible CLI Tool

Working with .json.gz files can be tedious, especially when you need to extract, edit, and recompress them manually. Meet jgze, a command-line tool that simplifies this process by allowing you to directly edit .json.gz files in a seamless workflow.

https://github.com/teihenn/jgze

What is jgze?

jgze is a CLI tool designed to let you edit .json.gz files without the hassle of separate decompression and recompression steps. It also provides flexibility in handling file formats during the editing process.

Key Features

  • Direct Editing: Open and edit .json.gz files as if they were plain JSON files.
  • Pretty Formatting During Editing: Regardless of the original file's format (compact or JSON Lines), the tool presents the content in a pretty-printed, readable structure during editing.
  • Automatic Reformatting: After editing, jgze saves the file back to its original format (e.g., compact, pretty-printed, or JSON Lines).

Usage

  1. Run jgze to open your .json.gz file in your preferred editor.(default: vim)
  2. Edit the content in a pretty-printed format for easier readability.
  3. Save and close – the file will automatically be compressed and reformatted to its original structure.
# Example usage
jgze your_file.json.gz
Enter fullscreen mode Exit fullscreen mode

Example: Compact to Pretty and Back to Compact

  • Original (Compact Format):
{"key1":"value1","key2":"value2","key3": "value3"}
Enter fullscreen mode Exit fullscreen mode
  • Editing (Pretty Format):
{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}
Enter fullscreen mode Exit fullscreen mode

Suppose you edited this as follows:

{
  "key1": "value1",
  "key2": "value2"
}
Enter fullscreen mode Exit fullscreen mode
  • Saved File (Reverted to Compact):
{"key1":"value1","key2":"value2"}
Enter fullscreen mode Exit fullscreen mode

Why Use jgze?

Traditional workflows with .json.gz files require decompression, manual editing, and recompression – a repetitive and error-prone process. With jgze, you can:

  • Save time by skipping manual steps.
  • Easily read and edit JSON content in pretty-printed format.
  • Preserve the file’s original format, ensuring compatibility with downstream systems.

Installation

You can install jgze via Cargo or download the pre-built binaries from the GitHub releases page.

# Install via Cargo
cargo install jgze
Enter fullscreen mode Exit fullscreen mode

Alternatively, download the appropriate binary for your platform from the GitHub repository.

Example Use Case

Imagine you're working with large .json.gz files. Instead of juggling multiple tools, use jgze to directly edit and maintain the file format.

Get Started

jgze is open-source and available on GitHub. Feel free to explore the repository.

💖 💪 🙅 🚩
teihenn
yyossy

Posted on November 17, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related