jsonfmt

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: BSD-3-Clause Imports: 9 Imported by: 6

Documentation

Overview

Package jsonfmt provides functionality for formatting JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(in []byte, opts ...Option) (out []byte, err error)

Format parses and formats the input JSON according to provided Options. If err is non-nil, then the output is a best effort at processing the input.

This function accepts a superset of the JSON specification that allows comments and trailing commas after the last element in an object or array.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures how to format JSON.

func Minify

func Minify() Option

Minify configures Format to produce the minimal representation of the input. If Format returns no error, then the output is guaranteed to be valid JSON,

func Standardize

func Standardize() Option

Standardize configures Format to produce valid JSON according to ECMA-404. This strips any comments and trailing commas.

Jump to

Keyboard shortcuts

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