package pretty
import "go.mongodb.org/mongo-driver/bson/internal/jsonpretty"
Index ¶
- Variables
- func NewOptions(json []byte, opts *Options) []byte
- func Pretty(json []byte) []byte
- func Ugly(json []byte) []byte
- func UglyInPlace(json []byte) []byte
- type Options
Variables ¶
DefaultOptions is the default options for pretty formats.
Functions ¶
func NewOptions ¶
NewOptions is like Pretty but with customized options.
func Pretty ¶
Pretty converts the input json into a more human readable format where each element is on it's own line with clear indentation.
func Ugly ¶
Ugly removes insignificant space characters from the input json byte slice and returns the compacted result.
func UglyInPlace ¶
UglyInPlace removes insignificant space characters from the input json byte slice and returns the compacted result. This method reuses the input json buffer to avoid allocations. Do not use the original bytes slice upon return.
Types ¶
type Options ¶
type Options struct { // Width is an max column width for single line arrays // Default is 80 Width int // Prefix is a prefix for all lines // Default is an empty string Prefix string // Indent is the nested indentation // Default is two spaces Indent string // SortKeys will sort the keys alphabetically // Default is false SortKeys bool }
NewOptions is Pretty options
Source Files ¶
pretty.go
- Version
- v0.0.2
- Published
- Mar 6, 2018
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 1 minute ago –
Tools for package owners.