json

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 7 Imported by: 8

Documentation

Overview

Package json contains logic for writing JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer interface {
	BeginObject()
	BeginObjectField(name string)
	BeginObjectBytesField(name []byte)
	EndObject()
	BeginArray()
	EndArray()
	WriteBool(b bool)
	WriteNull()
	WriteFloat64(n float64)
	WriteInt(n int)
	WriteString(s string)
	WriteBytesString(s []byte)
	Flush() error
	Close() error
}

A Writer can be used to directly stream JSON results without going through an intermediate object layer.

func NewNoopWriter added in v1.2.0

func NewNoopWriter() Writer

NewNoopWriter creates a JSON writer that does nothing.

func NewWriter

func NewWriter(w io.Writer) Writer

NewWriter creates a new JSON token writer

Jump to

Keyboard shortcuts

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