jsoncmd

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONCompact

func JSONCompact(data []byte) (string, error)

JSONCompact compacts JSON to a single line.

func JSONPretty

func JSONPretty(data []byte, indent string) (string, error)

JSONPretty pretty-prints JSON with custom indentation.

func JSONQuery

func JSONQuery(data []byte, path string) (interface{}, error)

JSONQuery queries JSON using dot-notation paths.

func Run

func Run(opts ...Option) error

Run processes JSON data.

Types

type Config

type Config struct {
	Mode   string
	Query  string
	Indent string
	Input  []byte
	Stdout io.Writer
}

Config holds configuration for the JSON command.

type Option

type Option func(*Config)

Option configures a Config.

func WithIndent

func WithIndent(indent string) Option

func WithInput

func WithInput(data []byte) Option

func WithMode

func WithMode(mode string) Option

func WithQuery

func WithQuery(query string) Option

func WithStdout

func WithStdout(w io.Writer) Option

Jump to

Keyboard shortcuts

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