Skip to content

Commit a97eac9

Browse files
committed
minor #18678 [Serializer] Add support for seld/jsonlint (ostrolucky)
This PR was merged into the 6.4 branch. Discussion ---------- [Serializer] Add support for seld/jsonlint Fixes #18660 Commits ------- 98c4b21 [Serializer] Add support for seld/jsonlint
2 parents 317d82c + 98c4b21 commit a97eac9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

components/serializer.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,24 @@ context to pass in these options using the key ``json_encode_options`` or
999999

10001000
$this->serializer->serialize($data, 'json', ['json_encode_options' => \JSON_PRESERVE_ZERO_FRACTION]);
10011001

1002+
These are the options available:
1003+
1004+
=============================== ===================================================== ================================
1005+
Option Description Default
1006+
=============================== ===================================================== ================================
1007+
``json_decode_associative`` If set to true returns the result as an array, ``false``
1008+
returns a nested ``stdClass`` hierarchy otherwise. ``false``
1009+
``json_decode_detailed_errors`` If set to true, exceptions thrown on parsing of JSON ``false``
1010+
are more specific. Requires `seld/jsonlint`_ package.
1011+
``json_encode_options`` `$flags`_ passed to `json_decode`_ function ``0``
1012+
``json_decode_options`` `$flags`_ passed to `json_encode`_ function ``\JSON_PRESERVE_ZERO_FRACTION``
1013+
``json_decode_recursion_depth`` Sets maximum recursion depth ``512``
1014+
=============================== ===================================================== ================================
1015+
1016+
.. versionadded:: 6.4
1017+
1018+
The support of ``json_decode_detailed_errors`` was introduced in Symfony 6.4.
1019+
10021020
The ``CsvEncoder``
10031021
~~~~~~~~~~~~~~~~~~
10041022

@@ -1828,3 +1846,7 @@ Learn more
18281846
.. _`RFC 4122`: https://tools.ietf.org/html/rfc4122
18291847
.. _`PHP reflection`: https://php.net/manual/en/book.reflection.php
18301848
.. _`data URI`: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
1849+
.. _seld/jsonlint: https://github.com/Seldaek/jsonlint
1850+
.. _json_decode: https://www.php.net/manual/en/function.json-decode.php
1851+
.. _json_encode: https://www.php.net/manual/en/function.json-encode.php
1852+
.. _$flags: https://www.php.net/manual/en/json.constants.php

0 commit comments

Comments
 (0)