classJsonPath
final class JsonPath
Evaluates the supported JSONPath subset: child names, quoted keys, array indices, wildcards and recursive names.
Methods§
public function select(mixed $value, string $path): list<array{path: string, value: mixed}>Selects the values a path matches.
Parameters
$value | mixed | The decoded document |
$path | string | The JSONPath, starting with $ |
Returns
list<array{path: string, value: mixed}> The matched values with their JSON PointersThrows
RuntimeException When the path does not start with $ or uses unsupported syntaxTest cases 5
Called from 1
public function children(
mixed $value,
string $path,
string $key,
bool $recursive,
): list<array{path: string, value: mixed}>Selects the children of a value named by one path step.
Parameters
$value | mixed | The value |
$path | string | The JSON Pointer of the value |
$key | string | The child name, index or * for every child |
$recursive | bool | Whether descendants are searched as well |
Returns
list<array{path: string, value: mixed}> The matched children with their JSON PointersTest cases 2
Called from 2
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
JsonPathTest::testChildrencallsJsonPathTest::testChildrenOfAnObjectcallsJsonPathTest::testSelectcallsJsonPathTest::testSelectReadsDecodedObjectscallsJsonPathTest::testSelectRejectsUnsupportedSyntaxcallsJsonPathTest::testSelectRequiresTheRootcallsJsonPathTest::testSelectRootIsTheWholeDocumentcalls
Other tests reaching this symbol 1
JsonSourceTestcalls