Skip to content

Commit 230072e

Browse files
committed
Minor tweaks
1 parent 481cb7a commit 230072e

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

components/json_path.rst

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ You can install the component in your project using Composer:
3030
Usage
3131
-----
3232

33-
To start querying a JSON document, first create a
34-
:class:`Symfony\\Component\\JsonPath\\JsonCrawler`object from a JSON string. The
35-
following examples use this sample "bookstore" JSON data::
33+
To start querying a JSON document, first create a :class:`Symfony\\Component\\JsonPath\\JsonCrawler`
34+
object from a JSON string. The following examples use this sample "bookstore"
35+
JSON data::
3636

3737
use Symfony\Component\JsonPath\JsonCrawler;
3838

@@ -77,9 +77,8 @@ following examples use this sample "bookstore" JSON data::
7777

7878
$crawler = new JsonCrawler($json);
7979

80-
Once you have the crawler instance, use its
81-
:method:`Symfony\\Component\\JsonPath\\JsonCrawler::find` method to start
82-
querying the data. This method returns an array of matching values.
80+
Once you have the crawler instance, use its :method:`Symfony\\Component\\JsonPath\\JsonCrawler::find`
81+
method to start querying the data. This method returns an array of matching values.
8382

8483
Querying with Expressions
8584
-------------------------
@@ -120,12 +119,7 @@ you to find values without specifying the full path::
120119
// get all authors from anywhere in the document
121120
$authors = $crawler->find('$..author');
122121

123-
// $authors is equals to [
124-
'Nigel Rees',
125-
'Evelyn Waugh',
126-
'Herman Melville',
127-
'John Ronald Reuel Tolkien'
128-
]
122+
// $authors is ['Nigel Rees', 'Evelyn Waugh', 'Herman Melville', 'John Ronald Reuel Tolkien']
129123

130124
Filtering Results
131125
~~~~~~~~~~~~~~~~~
@@ -141,9 +135,8 @@ Building Queries Programmatically
141135

142136
For more dynamic or complex query building, use the fluent API provided
143137
by the :class:`Symfony\\Component\\JsonPath\\JsonPath` class. This lets you
144-
construct a query object step by step. The ``JsonPath`` object can then be
145-
passed to the crawler's
146-
:method:`Symfony\\Component\\JsonPath\\JsonCrawler::find` method.
138+
construct a query object step by step. The ``JsonPath`` object can then be passed
139+
to the crawler's :method:`Symfony\\Component\\JsonPath\\JsonCrawler::find` method.
147140

148141
The main advantage of the programmatic builder is that it automatically handles
149142
escaping of keys and values, preventing syntax errors::
@@ -225,8 +218,7 @@ Testing with JSON Assertions
225218
----------------------------
226219

227220
The component provides a set of PHPUnit assertions to make testing JSON data
228-
more convenient. Use the
229-
:class:`Symfony\\Component\\JsonPath\\Test\\JsonPathAssertionsTrait`
221+
more convenient. Use the :class:`Symfony\\Component\\JsonPath\\Test\\JsonPathAssertionsTrait`
230222
in your test class::
231223

232224
use PHPUnit\Framework\TestCase;
@@ -308,11 +300,9 @@ Error Handling
308300
The component throws specific exceptions for invalid input or queries:
309301

310302
* :class:`Symfony\\Component\\JsonPath\\Exception\\InvalidArgumentException`:
311-
Thrown if the input to the ``JsonCrawler`` constructor is not a valid JSON
312-
string;
303+
Thrown if the input to the ``JsonCrawler`` constructor is not a valid JSON string;
313304
* :class:`Symfony\\Component\\JsonPath\\Exception\\InvalidJsonStringInputException`:
314-
Thrown during a ``find()`` call if the JSON string is malformed
315-
(e.g., syntax error);
305+
Thrown during a ``find()`` call if the JSON string is malformed (e.g., syntax error);
316306
* :class:`Symfony\\Component\\JsonPath\\Exception\\JsonCrawlerException`:
317307
Thrown for errors within the JsonPath expression itself, such as using an
318308
unknown function

0 commit comments

Comments
 (0)