JsonBrowser
class JsonBrowser implements IteratorAggregate
Helper class for working with JSON-encoded data
Constants
| OPT_NONEXISTENT_EXCEPTIONS |
Throw exceptions instead of using NULL for nonexistent children & siblings |
| ERR_DECODING_ERROR |
Error decoding JSON data |
| ERR_UNKNOWN_TYPE |
Encountered an unknown type |
| ERR_UNKNOWN_CHILD |
Unknown child |
| ERR_UNKNOWN_SIBLING |
Unknown sibling |
| TYPE_NULL |
NULL type |
| TYPE_BOOLEAN |
Boolean type |
| TYPE_STRING |
String type |
| TYPE_NUMBER |
Number type |
| TYPE_INTEGER |
Integer type (subset of TYPE_NUMBER) |
| TYPE_ARRAY |
Array type |
| TYPE_OBJECT |
Object type |
Methods
Create a new instance
Check whether a child element exists
Get a child node
Get an iterator handle
Get the JSON source for the current node
Get the node index key (i.e. the child name within the parent node)
Get the node at a given path
Get parent node
Get the node path
Get root node
Get a sibling node
Get the document value type
Get the document value
Get the value at a given path
Test whether the document value is not of a given type
Test whether the document value is of a given type
Check whether a sibling exists
Details
at line 81
__construct(string $json, int $options = 0)
Create a new instance
at line 117
bool
childExists(mixed $key)
Check whether a child element exists
at line 137
JsonBrowser
getChild(mixed $key)
Get a child node
at line 168
Iterator
getIterator()
Get an iterator handle
at line 181
string
getJSON(int $options = \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE)
Get the JSON source for the current node
at line 193
mixed
getKey()
Get the node index key (i.e. the child name within the parent node)
at line 206
JsonBrowser
getNodeAt(string $path)
Get the node at a given path
at line 227
JsonBrowser|null
getParent()
Get parent node
at line 239
string
getPath()
Get the node path
at line 251
JsonBrowser
getRoot()
Get root node
at line 264
JsonBrowser
getSibling(mixed $key)
Get a sibling node
at line 282
int
getType()
Get the document value type
at line 322
mixed
getValue()
Get the document value
at line 335
mixed
getValueAt(string $path)
Get the value at a given path
at line 348
bool
isNotType(int $types)
Test whether the document value is not of a given type
at line 362
bool
isType(int $types, bool $all = false)
Test whether the document value is of a given type
at line 378
bool
siblingExists(mixed $key)
Check whether a sibling exists