symfony/json-path
Eases JSON navigation using the JSONPath syntax as described in RFC 9535
Maintainers
v8.1.0
2026-05-29 05:06 UTC
Requires
- php: >=8.4.1
- symfony/polyfill-ctype: ^1.8
- symfony/polyfill-mbstring: ^1.0
Requires (Dev)
- jsonpath-standard/jsonpath-compliance-test-suite: *
- symfony/json-streamer: ^7.4|^8.0
- symfony/service-contracts: ^2.5|^3
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT 7630e677d3d081172c9ba9a98914ed2f5b19acc2
- Alexandre Daubois <alex.daubois.woop@gmail.com>
- Symfony Community
This package is auto-updated.
Last update: 2026-06-05 06:50:56 UTC
README
The JsonPath component eases JSON navigation using the JSONPath syntax as described in RFC 9535.
Getting Started
composer require symfony/json-path
use Symfony\Component\JsonPath\JsonCrawler; $json = <<<'JSON' {"store": {"book": [ {"category": "reference", "author": "Nigel Rees", "title": "Sayings", "price": 8.95}, {"category": "fiction", "author": "Evelyn Waugh", "title": "Sword", "price": 12.99} ]}} JSON; $crawler = new JsonCrawler($json); $result = $crawler->find('$.store.book[0].title'); $result = $crawler->find('$.store.book[?match(@.author, "[A-Z].*el.+")]'); $result = $crawler->find("$.store.book[?(@.category == 'fiction')].title");
Updating the Compliance Test Suite
The compliance test suite is gathered from the JSONPath Test Suite.
When new commits are pushed to the upstream repository, it is necessary to gather them by following these steps:
- Update the
referencefield ofcomposer.jsonto the latest commit hash of thejsonpath-standard/jsonpath-compliance-test-suitepackage - Update the
versionfield to the date of the commit - Repeat the steps above for the
composer.jsonfile present at the root level of thesymfony/symfonyrepository - Run
composer update - Ensure the tests pass
Sponsor
This package is looking for a backer.
Help Symfony by sponsoring its development!
