gojson

command module
v0.0.0-...-99cbe0a Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: MIT Imports: 11 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

GoJSON Go Report Card Last Commit Go

🎉 GoJSON 🚀 - A command-line utility to jazz up your JSON handling!

🛠️ Built for fun during a never-ending 3-hour meeting where I just nodded along. 🙃 If you're scouting for some seriously useful JSON command-line tools, check out the list below!

  • dsq - Tool for running SQL queries against JSON, CSV, Excel, Parquet, and more.
  • fx - A interactive terminal tool.
  • jo - A small utility to create JSON objects
  • jsoncat - Pretty-print Json in terminal with colors and adjusting tabs size.
  • jq - A lightweight and flexible command-line JSON processor.
  • json - A "json" command for massaging JSON on your Unix command line.
  • jshon - A parser designed for maximum convenience within the shell.
  • jarg - Shorthand JSON and form encoding syntax in the shell.
  • jsawk - Like awk, but for JSON.
  • json-dotenv - Manipulate and extract envfiles in json format.
  • gron - Convert a JSON file into discrete assignments that are greppable.
  • jid - Incremental Digger. Drill down JSON interactively by using filtering queries like jq.
  • jiq - It's jid with jq. You can drill down interactively by using jq filtering queries.
  • jv - jv (for jsonviewer) helps you view your JSON.
  • jl - Functional sed for JSON.
  • oj - A fast and flexible command line JSON processor.
  • visidata - A terminal spreadsheet-like tool for interactively exploring data.

What gojson does

  • Retrieve nested objects
  • Pretty print JSON
  • Validate JSON
  • Aggregate functions

Installing

Go Dev version

go install  github.com/sarathsp06/gojson@latest

Binray Release

download and use the binary as such for your platform

Tip:

In unix move the binary to PATH

Key Syntax
  • Key is a set of . seperated nested values
  • Can use 0-n numbers to refer to index in arrays
  • Can use lower:upper syntax to refer to a range of an array. Eg: players.1:3
  • Can use keys of inner objects directly on arrays or range of them. Eg: players.name where players is an array

Usage Examples

Getting a value
  • Get a string:
$ echo '{"name":{"first":"Sarath","last":"Pillai"}}' | gojson name.last
"Pillai"
  • Get a block of JSON:
$ echo '{"name":{"first":"Sarath","last":"Pillai"}}'  | gojson name

{
  "first": "Sarath",
  "last": "Pillai"
}
  • Try to get a non-existent key:
$ echo '{"name":{"first":"Sarath","last":"Pillai"}}' | gojson names
nil

  • Get an array value by index:
$ echo '{"people":[{"name":"saratha"},{"name":"syam"}]}' | gojson people.1.name
"syam"
  • Projection from a slice
$ echo '{"people":[{"name":"saratha"},{"name":"syam"},{"name":"singh"},{"name":"ping"}]}' | gojson people.2:.name 
[
  "singh",
  "ping"
]
  • Slice of array
$ echo '{"people":[{"name":"saratha"},{"name":"syam"},{"name":"singh"},{"name":"ping"}]}' | gojson people.2:5
[
  {
    "name": "singh"
  },
  {
    "name": "ping"
  }
]
  • Handling JSON key names with a .:
$ echo '{"first.name":"Sarath","last.name":"Pillai"}' | gojson \"first.name\"
"Sarath"

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
⌂ 换网址