JsonExtractor.GetObject

JSON object getter, invokes registered field getters with type and value of the corresponding fields in a JSON object.

Constructors

this
this(Parser json, GetField[cstring] get_named_fields, GetField[] get_indexed_fields)

Constructor, specifies getters for named and unnamed fields.

this
this(Parser json, bool skip_null, GetField[cstring] get_named_fields, GetField[] get_indexed_fields)

Constructor, specifies getters for named and unnamed fields.

Members

Functions

addNamedField
void addNamedField(cstring name, GetField field)

Add the field to the list of named objects to get.

removeNamedField
void removeNamedField(cstring name)

Remove a field from the list of named objects to get.

reset_
void reset_()

Called by super.reset() to reset all field getters.

setField
bool setField(uint i, Type type, cstring name, cstring value)

Picks the field getter responsible for the field corresponding to name, or i if unnamed, and sets its type and value.

set_
void set_()

Called by super.reset() to reset all field getters.

Variables

strict
bool strict;

If enabled, any unmatched field will result in an exception.

Inherited Members

From IterateAggregate

start_type
Type start_type;
end_type
Type end_type;

Start and end token type, usually BeginObject/EndObject or BeginArray/EndArray.

exception
JsonException exception;

Exception throw to indicate errors during parsing.

set_
void set_()

Invoked by super.set() to iterate over the JSON object or array. Expects the type of the current token to be - the start type if this.skip_null is false or - the start type or null if this.skip_null is true.

setField
bool setField(uint i, Type type, cstring name, cstring value)

Abstract iteration method, must either use an appropriate GetField (or subclass) instance to handle and move the parser to the end of the field or indicate that this field is ignored and unhandled.

Meta