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

$valuemixedThe decoded document
$pathstringThe JSONPath, starting with $

Returns

list<array{path: string, value: mixed}> The matched values with their JSON Pointers

Throws

RuntimeException When the path does not start with $ or uses unsupported syntax
Test cases 5
Called from 1
Calls 8
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

$valuemixedThe value
$pathstringThe JSON Pointer of the value
$keystringThe child name, index or * for every child
$recursiveboolWhether descendants are searched as well

Returns

list<array{path: string, value: mixed}> The matched children with their JSON Pointers
Test cases 2
Called from 2
Calls 5

Test cases 8§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 7
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Method calls 1