JSONObject

JSONObject represents a single JSON object node and has methods for adding children. All methods that make changes modify this JSONObject rather than making a copy, unless otherwise noted. Many methods return a self reference to allow cascaded calls.

Constructors

this
this()

Nothing to see here except for the boring constructor, move along.

Members

Functions

length
ulong length()

Allow the user to get the number of elements in this object

opApply
int opApply(int delegate(ref JSONType) dg)

Operator overload for foreach iteration through the object with values only and allow modification of the reference

opApply
int opApply(int delegate(ref string, ref JSONType) dg)

Operator overload for foreach iteration through the object with key and value and allow modification of the reference

opIn_r
JSONType* opIn_r(string key)

Allow "in" operator to work as expected for object types without an explicit cast

opIndex
JSONType opIndex(string key)

Operator overload for accessing values already in the AA.

opIndexAssign
void opIndexAssign(JSONType type, string key)
void opIndexAssign(string val, string key)
void opIndexAssign(bool val, string key)
void opIndexAssign(long val, string key)
void opIndexAssign(real val, string key)
void opIndexAssign(int val, string key)

Operator overload for setting keys in the AA.

parse
void parse(string source)

This function parses a JSONObject out of a string

toPrettyString
string toPrettyString(string indent)

A method to convert this JSONObject to a formatted, user-readable format.

toString
string toString()

A method to convert this JSONObject to a user-readable format.

Variables

_children
JSONType[string] _children;
Undocumented in source.

Inherited Members

From JSONType

toString
string toString()
Undocumented in source.
toPrettyString
string toPrettyString(string indent)
Undocumented in source.
parse
void parse(string source)

The parse method of this interface should ALWAYS be destructive, removing things from the front of source as it parses.

toJSONObject
JSONObject toJSONObject()

Convenience function for casting to JSONObject

toJSONArray
JSONArray toJSONArray()

Convenience function for casting to JSONArray

toJSONString
JSONString toJSONString()

Convenience function for casting to JSONString

toJSONBoolean
JSONBoolean toJSONBoolean()

Convenience function for casting to JSONBoolean

toJSONNumber
JSONNumber toJSONNumber()

Convenience function for casting to JSONNumber

toJSONNull
JSONNull toJSONNull()

Convenience function for casting to JSONNull

opIndex
JSONType opIndex(string key)

Associative array index function for objects describing associative array-like attributes.

opApply
int opApply(int delegate(ref string, ref JSONType) dg)

Allow foreach over the object with string key and ref value.

opIndex
JSONType opIndex(int key)

Array index function for objects describing array-like attributes.

opApply
int opApply(int delegate(ref ulong, ref JSONType) dg)

Allow foreach over the object with integer key and ref value.

opApply
int opApply(int delegate(ref JSONType) dg)

Convenience function for iteration that apply to both AA and array type operations with ref value

opIn_r
JSONType* opIn_r(string key)

Allow "in" operator to work as expected for object types without an explicit cast

Meta