Lyricdev
GitHub

class JsonReader

pub class JsonReader :: [Decoder]

Conforms to Decoder.

The decoder over a JSON tree: a struct from an object by its members' names, a sequence from an array, a map from an object (its keys as strings, or as the numbers they spell), a variant from its name or from an object of one member, bytes from a Base64 string. A read that mismatches leaves the value where it was.

Methods

pub mut fn isNull(): bool throws DecodeError
pub mut fn decodeNull(): void throws DecodeError
pub mut fn decodeBool(): bool throws DecodeError
pub mut fn decodeInt(): int throws DecodeError
pub mut fn decodeUint(): uint throws DecodeError
pub mut fn decodeFloat(): float throws DecodeError
pub mut fn decodeString(): string throws DecodeError
pub mut fn decodeBytes(): uint8[] throws DecodeError
pub mut fn beginSeq(): ?int throws DecodeError
pub fn seqHasNext(): bool throws DecodeError
pub mut fn endSeq(): void throws DecodeError
pub mut fn beginMap(): ?int throws DecodeError
pub fn mapHasNext(): bool throws DecodeError
pub mut fn endMap(): void throws DecodeError
pub mut fn beginStruct(name: string, fields: string[]): void throws DecodeError
pub mut fn structField(name: string): bool throws DecodeError
pub mut fn endStruct(denyUnknown: bool): void throws DecodeError
pub mut fn beginVariant(enumName: string, variants: string[]): int throws DecodeError
pub fn variantHasPayload(): bool throws DecodeError
pub mut fn endVariant(): void throws DecodeError
pub fn path(): string

Returns where the decoder stands, such as Team.members[0].User: a struct's name and the member being read with . between, an array's index without, {} for a map, a variant's name.