|
|
Allows easy retrieval of entities by array index or object key name
- Example
printf("User %d name %s",
(int)myJsonRef("users")[0]("id"),
(const char *)myJsonRef("users")[0]("name")
);
|
| JsonRef | operator[] (int i) |
| | Get a JsonRef from an array by numerical index.
|
| |
| JsonRef | object (const char *name) |
| | Get a JsonRef representing an object from a parent object by key name.
|
| |
| JsonRef | name (const char *name) |
| | Get a JsonRef representing any entity from a parent object by key name.
|
| |
| JsonRef | operator() (const char *namev) |
| | Get a JsonRef representing any entity from a parent object by key name.
|
| |
|
Allows casting of a JsonRef to the desired type
- Example
bool b = (bool)myJsonRef("user")("isEnabled");
int i = (int)myJsonRef("user")("id");
const char *str = (const char *)myJsonRef("user")("name");
|
| | operator bool () const |
| | Operator to return a JSON element of type boolean.
|
| |
| | operator float () const |
| | Operator to return a JSON element of type float.
|
| |
| | operator double () const |
| | Operator to return a JSON element of type double.
|
| |
| | operator uint8_t () const |
| | Operator to return a JSON element of type uint8_t.
|
| |
| | operator int () const |
| | Operator to return a JSON element of type int.
|
| |
| | operator uint16_t () const |
| | Operator to return a JSON element of type uint16_t.
|
| |
| | operator uint32_t () const |
| | Operator to return a JSON element of type uint32_t.
|
| |
| | operator int8_t () const |
| | Operator to return a JSON element of type int8_t.
|
| |
| | operator int16_t () const |
| | Operator to return a JSON element of type int16_t.
|
| |
| | operator int32_t () const |
| | Operator to return a JSON element of type int32_t.
|
| |
| | operator time_t () const |
| | Operator to return a JSON element of type time_t.
|
| |
| | operator const char * () const |
| | Operator to return a JSON element of type const char *.
|
| |
| | operator NBString () const |
| | Operator to return a JSON element of type NBString.
|
| |
|
| bool | IsNumber () |
| | Check if the current JsonRef is a valid JSON number element.
|
| |
| bool | IsObject () |
| | Check if the current JsonRef is a valid JSON object element.
|
| |
| bool | IsString () |
| | Check if the current JsonRef is a valid JSON string element.
|
| |
| bool | IsBool () |
| | Check if the current JsonRef is a valid JSON boolean element.
|
| |
| bool | IsNull () |
| | Check if the current JsonRef is a valid JSON null element.
|
| |
| bool | IsArray () |
| | Check if the current JsonRef is a valid JSON array element.
|
| |
| bool | Valid () const |
| | Check if the current JsonRef is a valid JSON position.
|
| |
|
|
JsonRef | start () |
| | Begin traversal: check for ref validity and reset the position.
|
| |
|
JsonRef | next () const |
| | Traverse: check for ref validity and increment the position.
|
| |
|
bool | IncPosition () |
| | Increment the position index of the ParsedJsonDataSet.
|
| |
|
bool | JumpPosition (int siz) |
| | Jump to a specific position index in the ParsedJsonDataSet.
|
| |
|
void | ResetPosition () |
| | Reset the position index of the ParsedJsonDataSet to the beginning.
|
| |
|
void | SkipElement () |
| | Increment the position index of the ParsedJsonDataSet beyond this element.
|
| |
|
void | SkipArray () |
| | Increment the position index of the ParsedJsonDataSet beyond this array.
|
| |
|
void | SkipObject () |
| | Increment the position index of the ParsedJsonDataSet beyond this object.
|
| |
|
|
int | PrintChildren (bool pretty=false) |
| | Output child objects of this JsonRef as JSON text to stdout.
|
| |
|
int | PrintChildrenToFd (int fd, bool pretty=false) |
| | Output child objects of this JsonRef as JSON text to a file descriptor.
|
| |
|
int | PrintChildrenToBuffer (char *buffer, int maxlen, bool pretty=false) |
| | Output child objects of this JsonRef as JSON text to a buffer pointer.
|
| |
|
int | PrintChildrenToString (NBString &s, bool pretty=false) |
| | Output child objects of this JsonRef as JSON text to a NBString.
|
| |
| int | GetChildPrintSize (bool pretty=false) |
| | Return the length of the child objects' JSON text as written with the PrintChildren* functions.
|
| |
|
void | DiagDump (const char *lab) |
| | Output a verbose diagnostic report of the ParsedJsonDatSet to stdout.
|
| |
| void | MakeInvalid () |
| |
Represents a positional reference (pointer) of a location inside a ParsedJsonDataSet object.
A JsonRef can be used as a pointer to a variable or sub object inside a ParsedJsonDataSet object to make decoding the hierarchy much simpler and easier to understand. A JsonRef is not limited to just pointing at internal objects; it can point to any JSON parsed token/type.