Skip to content

Latest commit

 

History

History
29 lines (25 loc) · 1019 Bytes

README.md

File metadata and controls

29 lines (25 loc) · 1019 Bytes

Loose Schema Navigator

Build Status Maintainability Test Coverage

Example usage

$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"