Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Default = &Settings{ EndWithNewline: true, Newlines: true, Indent: " ", Separator: " ", Color: nil, }
Default contains the default settings used to colorize and format the JSON document.
var DefaultColors = &ColorSettings{ Ident: Cyan | Bold, String: Green, Number: Yellow, Null: Grey, False: Red, True: Green, }
DefaultColors is the default color scheme.
var Jq = &Settings{ EndWithNewline: true, Newlines: true, Indent: " ", Separator: " ", Color: JqColors, }
Jq contains the settings used to colorize and format the JSON document to look like the output from jq.
var JqColors = &ColorSettings{ Ident: Blue | Bold, String: Green, Number: Reset, Null: Grey, False: Reset, True: Reset, }
JqColors is the color scheme used by jq.
Functions ¶
func ColorizeData ¶
ColorizeData colorizes the given data and returns the result. If s is nil, the default settings are used.
Types ¶
type Color ¶
type Color int
Color is a color used to highlight something in the JSON document.
const (
Bold Color = 0x100
)
type ColorSettings ¶
type ColorSettings struct { Ident Color String Color Number Color Null Color False Color True Color }
ColorSettings contains the colors used to highlight the different parts of the JSON document.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder is a JSON encoder that colorizes the output.
func NewEncoder ¶
NewEncoder returns a new encoder that writes to w. If settings is nil, the default settings are used.
func (*Encoder) ColorizeData ¶
ColorizeData colorizes the JSON data and writes it to the stream.