Documentation
¶
Index ¶
- func Beautify(data []byte, indent string) ([]byte, error)
- func Format(data []byte, opts Options) ([]byte, error)
- func GetType(data []byte) string
- func IsValid(data []byte) bool
- func Keys(data []byte) ([]string, error)
- func Minify(data []byte) ([]byte, error)
- func MustBeautify(data []byte) []byte
- func MustMinify(data []byte) []byte
- func RunJSONFmt(w io.Writer, args []string, opts Options) error
- func SortKeys(data []byte) ([]byte, error)
- func Validate(data []byte) error
- type Options
- type Result
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustBeautify ¶
MustBeautify formats JSON and panics on error
func RunJSONFmt ¶
RunJSONFmt formats JSON input
Types ¶
type Options ¶
type Options struct {
Minify bool // -m: minify (compact) output
Indent string // -i: indentation string (default " ")
SortKeys bool // -s: sort object keys
Validate bool // -v: validate only, don't output
EscapeHTML bool // -e: escape HTML characters
JSON bool // --json: output result as JSON (for validate mode)
Tab bool // -t: use tabs for indentation
}
Options configures the json format command behavior
type Result ¶
type Result struct {
Valid bool `json:"valid"`
Error string `json:"error,omitempty"`
File string `json:"file,omitempty"`
}
Result represents the JSON output for validate mode
Click to show internal directories.
Click to hide internal directories.