1
1
Json
2
+ ====
2
3
3
- Validates that a value is valid ``json ``. Specifically, this checks to see if
4
- the value is a valid ``json `` or not.
4
+ Validates that a value has valid `JSON `_ syntax.
5
5
6
6
+----------------+-----------------------------------------------------------------------+
7
7
| Applies to | :ref: `property or method <validation-property-target >` |
@@ -17,9 +17,7 @@ the value is a valid ``json`` or not.
17
17
Basic Usage
18
18
-----------
19
19
20
- The ``Json `` constraint can be applied to a property or a "getter" method,
21
- but is most commonly useful in the latter case. For example, suppose that
22
- you want to guarantee that some ``jsonString `` property is valid JSON.
20
+ The ``Json `` constraint can be applied to a property or a "getter" method:
23
21
24
22
.. configuration-block ::
25
23
@@ -60,7 +58,7 @@ you want to guarantee that some ``jsonString`` property is valid JSON.
60
58
<class name =" App\Entity\Book" >
61
59
<property name =" chapters" >
62
60
<constraint name =" Json" >
63
- <option name" message" >You've entered an invalid Json.</option >
61
+ <option name = " message" >You've entered an invalid Json.</option >
64
62
</constraint >
65
63
</property >
66
64
</class >
@@ -94,6 +92,8 @@ message
94
92
95
93
**type **: ``string `` **default **: ``This value should be valid JSON. ``
96
94
97
- This message is shown if the underlying data is not a valid JSON.
95
+ This message is shown if the underlying data is not a valid JSON value .
98
96
99
97
.. include :: /reference/constraints/_payload-option.rst.inc
98
+
99
+ .. _`JSON` : https://en.wikipedia.org/wiki/JSON
0 commit comments