PHP code example of loilo / jsonpath
1. Go to this page and download the library: Download loilo/jsonpath library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
loilo / jsonpath example snippets
use Loilo\JsonPath\JsonPath;
$query = new JsonPath('$.users[*].name');
$result = $query->find([
'users' => [
[ 'name' => 'John Doe' ],
[ 'name' => 'Jane Doe' ],
],
]);
var_dump($result);
/*
Prints:
array(2) {
[0]=>
string(8) "John Doe"
[1]=>
string(8) "Jane Doe"
}
*/
sh
git clone https://github.com/loilo/jsonpath-php.git
cd jsonpath-php