44 $format = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES;
46 return json_encode($this->json,
$format) .
"\n";
66 public function get($propertyPath, $filter =
null)
68 $result = $this->traverseGet($this->json, explode(
'->', $propertyPath));
71 if (!preg_match($filter, $key)) {
87 private function traverseGet(\StdClass $json, array $chain,
$index = 0)
89 $property = $chain[
$index];
90 if (!property_exists($json, $property)) {
93 if (isset($chain[
$index + 1])) {
94 return $this->traverseGet($json->{$property}, $chain,
$index + 1);
96 return $json->{$property};
getJson($formatted=true, $format=null)
__construct(\stdClass $json)