class JsonWriter
pub class JsonWriter :: [Encoder]
Conforms to Encoder.
The encoder that writes JSON text: compact, or pretty with newlines and indentation.
Methods
pub static fn new(opts: JsonOptions = JsonOptions { }): JsonWriter
Returns a writer under the options; a program hands it to v.encode(&w) and takes
text().
pub fn text(): string
Returns the text written so far.
pub mut fn encodeNull(): void throws EncodeError
pub mut fn encodeBool(v: bool): void throws EncodeError
pub mut fn encodeInt(v: int): void throws EncodeError
pub mut fn encodeUint(v: uint): void throws EncodeError
pub mut fn encodeFloat(v: float): void throws EncodeError
pub mut fn encodeString(v: string): void throws EncodeError
pub mut fn encodeBytes(v: Slice<uint8>): void throws EncodeError
pub mut fn beginSeq(count: int): void throws EncodeError
pub mut fn endSeq(): void throws EncodeError
pub mut fn beginMap(count: int): void throws EncodeError
pub mut fn beginKey(): void throws EncodeError
pub mut fn endMap(): void throws EncodeError
pub mut fn beginStruct(name: string, count: int): void throws EncodeError
pub mut fn beginField(name: string): void throws EncodeError
pub mut fn endStruct(): void throws EncodeError
pub mut fn beginVariant(
enumName: string,
variant: string,
index: int,
hasPayload: bool
): void throws EncodeError
pub mut fn endVariant(): void throws EncodeError
pub fn path(): string