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

teihennteihenn
2 min read

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

Example: Compact to Pretty and Back to Compact

  1. Original (Compact Format):
{"key1":"value1","key2":"value2","key3": "value3"}
  1. Editing (Pretty Format):
{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}

Suppose you edited this as follows:

{
  "key1": "value1",
  "key2": "value2"
}
  1. Saved File (Reverted to Compact):
{"key1":"value1","key2":"value2"}

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

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.

0
Subscribe to my newsletter

Read articles from teihenn directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

teihenn
teihenn