@@ -39,6 +39,7 @@ JSONPath | Result
3939` $..books[1:6:3] ` | every third book starting from 1 till 6
4040` $..books[?(@.isbn)] ` | filter all books with isbn number
4141` $..books[?(@.price<10)] ` | filter all books cheaper than 10
42+ ` $..books.length ` | the amount of books
4243` $..* ` | all elements in the data (recursively extracted)
4344
4445
@@ -62,7 +63,8 @@ Symbol | Description
6263#### Using arrays
6364
6465``` php
65- use Flow\JSONPath\JSONPath;
66+ <?php
67+ require_once __DIR__ . '/vendor/autoload.php';
6668
6769$data = ['people' => [
6870 ['name' => 'Sascha'],
@@ -71,7 +73,7 @@ $data = ['people' => [
7173 ['name' => 'Maximilian'],
7274]];
7375
74- print_r((new JSONPath($data))->find('$.people.*.name')->getData());
76+ print_r((new \Flow\JSONPath\ JSONPath($data))->find('$.people.*.name')->getData());
7577
7678/*
7779Array
@@ -87,11 +89,12 @@ Array
8789#### Using objects
8890
8991``` php
90- use Flow\JSONPath\JSONPath;
92+ <?php
93+ require_once __DIR__ . '/vendor/autoload.php';
9194
9295$data = json_decode('{"name":"Sascha Greuel","birthdate":"1987-12-16","city":"Gladbeck","country":"Germany"}', false);
9396
94- print_r((new JSONPath($data))->find('$')->getData()[0]);
97+ print_r((new \Flow\JSONPath\ JSONPath($data))->find('$')->getData()[0]);
9598
9699/*
97100stdClass Object
@@ -204,4 +207,3 @@ A list of changes can be found in the [CHANGELOG.md](CHANGELOG.md) file.
204207 </td>
205208</tr >
206209</table >
207-
0 commit comments