$data = <<<JSONSTR
{
"foo":"123",
"bar":{
"baz": "true",
"buzz": "{\"abc\":\"xyz\"}"
}
}
JSONSTR;
$nav = new Navigator($data);
$nav->foo->int(); // 123
$nav->foo->string(); // "123"
$nav->missingProp->int(); // 0
$nav->missingProp->int(-1); // -1
$nav->bar->baz->int(); // 1
$nav->bar->baz->bool(); // true
$nav->bar->buzz->string(); // "{"abc":"xyz"}"
$nav->bar->buzz->object(); // {"abc":"xyz"}
$nav->bar->buzz->array(); // ["abc" => "xyz"]
$nav->bar->buzz->abc->string(); // "xyz"
-
Notifications
You must be signed in to change notification settings - Fork 1
Carefree traversal of data structures with eventual strict typing
License
mrubiosan/loose-schema-navigator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Carefree traversal of data structures with eventual strict typing
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published