CARVIEW |
symfony / json-path
Eases JSON navigation using the JSONPath syntax as described in RFC 9535
Fund package maintenance!
fabpot
nicolas-grekas
symfony.com/sponsor
Tidelift
Installs: 23 083
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 2
Forks: 0
pkg:composer/symfony/json-path
Requires
- php: >=8.2
- symfony/polyfill-ctype: ^1.8
- symfony/polyfill-mbstring: ~1.0
Requires (Dev)
- symfony/json-streamer: 7.3.*
Suggests
None
Provides
None
Conflicts
- symfony/json-streamer: >=7.4
Replaces
None
MIT 8d9c00131005003a082ab67cb496d58b74957833
- Alexandre Daubois <alex.daubois.woop@gmail.com>
- Symfony Community
This package is auto-updated.
Last update: 2025-10-01 14:43:25 UTC
README
The JsonPath component eases JSON navigation using the JSONPath syntax as described in RFC 9535.
This Component is experimental. Experimental features are not covered by Symfony's Backward Compatibility Promise.
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");