gojq

command module
v0.0.0-...-3e8dde9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ΒΆ

gojq

A minimal CLI tool like jq that pretty-prints JSON from a stream. If the input isn't valid JSON, it just prints it as-is. Useful for working with structured logs like zerolog.

πŸ”§ Features

  • βœ… Pretty-prints JSON from stdin
  • βœ… Gracefully falls back to plain output for non-JSON lines
  • 🎨 Optional colored JSON output (default)
  • πŸ“¦ Supports flags for compact output or no color

πŸ§ͺ Example Usage

your-app | gojq

Output:

{
  "level": "info",
  "msg": "Order created",
  "time": "2025-03-21T13:12:17Z"
}

πŸš€ Install

From source:
go install github.com/trythrow/gojq@latest

Make sure $GOBIN is in your $PATH.

Or run directly (for testing):
echo '{"hello":"world"}' | go run .

🏁 Flags

Flag Description
--no-color Disable color output
--compact Output compact JSON (no indent)
Examples
your-app | gojq --no-color
your-app | gojq --compact
your-app | gojq --no-color --compact

πŸ”— License

MIT Β© Ahmad Said

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 捒网址