Skip to content

Commit c5e5831

Browse files
committed
add serialize reference
1 parent 5266709 commit c5e5831

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

reference/twig_reference.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,26 @@ project's root directory:
558558
If the given file path is out of the project directory, a ``null`` value
559559
will be returned.
560560

561+
serialize
562+
~~~~~~~~~
563+
564+
.. code-block:: twig
565+
566+
{{ object|serialize(format = 'json') }}
567+
568+
``object``
569+
**type**: ``object``
570+
571+
``format`` *(optional)*
572+
**type**: ``string``
573+
574+
.. versionadded:: 5.3
575+
576+
The ``serialize`` filter was introduced in Symfony 5.3.
577+
578+
Accepts any object that can be serialized by Symfony's Serializer Component and
579+
returns the serialized object in the specified ``format``.
580+
561581
.. _reference-twig-tags:
562582

563583
Tags

0 commit comments

Comments
 (0)