json.object

Module for [ObjectWrap] class

Types 1

json.object.ObjectWrap is the representation of the object type inside JSON.

A json.object.ObjectWrap contains json.node.Node "members", which may contain fundamental types, arrays or other objects; each member of an object is accessed using a unique string, or "name".

Since objects can be arbitrarily big, copying them can be expensive; for this reason they are reference counted. You can control the lifetime of a json.object.ObjectWrap using json.object.ObjectWrap.ref_ and json.object.ObjectWrap.unref.

To add or overwrite a member with a given name, use json.object.ObjectWrap.setMember.

To extract a member with a given name, use json.object.ObjectWrap.getMember.

To retrieve the list of members, use json.object.ObjectWrap.getMembers.

To retrieve the size of the object (that is, the number of members it has), use json.object.ObjectWrap.getSize.

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup) nothrow
GType _getGType() static nothrow
GType _gType() @property nothrow
ObjectWrap self() nothrowReturns `this`, for use in `with` statements.
void addMember(string memberName, json.node.Node node) nothrowAdds a new member for the given name and value into an object.
json.node.Node dupMember(string memberName) nothrowRetrieves a copy of the value of the given member inside an object.
bool equal(json.object.ObjectWrap b) nothrowCheck whether `a` and `b` are equal objects, meaning they have the same set of members, and the values of corresponding members are equal.
void foreachMember(json.types.ObjectForeach func) nothrowIterates over all members of object and calls func on each one of them.
json.array.Array getArrayMember(string memberName) nothrowConvenience function that retrieves the array stored in member_name of object. It is an error to specify a member_name which does not exist.
bool getBooleanMember(string memberName) nothrowConvenience function that retrieves the boolean value stored in member_name of object. It is an error to specify a member_name which does not exist.
bool getBooleanMemberWithDefault(string memberName, bool defaultValue) nothrowConvenience function that retrieves the boolean value stored in member_name of object.
double getDoubleMember(string memberName) nothrowConvenience function that retrieves the floating point value stored in member_name of object. It is an error to specify a member_name which does not exist.
double getDoubleMemberWithDefault(string memberName, double defaultValue) nothrowConvenience function that retrieves the floating point value stored in member_name of object.
long getIntMember(string memberName) nothrowConvenience function that retrieves the integer value stored in member_name of object. It is an error to specify a member_name which does not exist.
long getIntMemberWithDefault(string memberName, long defaultValue) nothrowConvenience function that retrieves the integer value stored in member_name of object.
json.node.Node getMember(string memberName) nothrowRetrieves the value of the given member inside an object.
string[] getMembers() nothrowRetrieves all the names of the members of an object.
bool getNullMember(string memberName) nothrowConvenience function that checks whether the value stored in member_name of object is null. It is an error to specify a member_name which does not exist.
json.object.ObjectWrap getObjectMember(string memberName) nothrowConvenience function that retrieves the object stored in member_name of object. It is an error to specify a member_name which does not exist.
uint getSize() nothrowRetrieves the number of members of a JSON object. Returns: the number of members
string getStringMember(string memberName) nothrowConvenience function that retrieves the string value stored in member_name of object. It is an error to specify a member_name that does not exist.
string getStringMemberWithDefault(string memberName, string defaultValue) nothrowConvenience function that retrieves the string value stored in member_name of object.
json.node.Node[] getValues() nothrowRetrieves all the values of the members of an object. Returns: the member values of the object
bool hasMember(string memberName) nothrowChecks whether object has a member named member_name.
uint hash() nothrowCalculate a hash value for the given key (a JSON object).
bool isImmutable() nothrowChecks whether the given object has been marked as immutable by calling [json.object.ObjectWrap.seal] on it. Returns: `TRUE` if the object is immutable
void removeMember(string memberName) nothrowRemoves member_name from object, freeing its allocated resources.
void seal() nothrowSeals the object, making it immutable to further changes.
void setArrayMember(string memberName, json.array.Array value) nothrowConvenience function for setting an object member with an array value.
void setBooleanMember(string memberName, bool value) nothrowConvenience function for setting an object member with a boolean value.
void setDoubleMember(string memberName, double value) nothrowConvenience function for setting an object member with a floating point value.
void setIntMember(string memberName, long value) nothrowConvenience function for setting an object member with an integer value.
void setMember(string memberName, json.node.Node node) nothrowSets the value of a member inside an object.
void setNullMember(string memberName) nothrowConvenience function for setting an object member with a `null` value.
void setObjectMember(string memberName, json.object.ObjectWrap value) nothrowConvenience function for setting an object member with an object value.
void setStringMember(string memberName, string value) nothrowConvenience function for setting an object member with a string value.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new object. Returns: the newly created object