diff --git a/core/serialization.md b/core/serialization.md
index caaaca3034a..3c88b217b7b 100644
--- a/core/serialization.md
+++ b/core/serialization.md
@@ -11,7 +11,7 @@ The main serialization process has two stages:
![Serializer workflow](images/SerializerWorkflow.png)
> As you can see in the picture above, an array is used as a man-in-the-middle. This way, Encoders will only deal with turning specific formats into arrays and vice versa. The same way, Normalizers will deal with turning specific objects into arrays and vice versa.
--- [The Symfony documentation](https://symfony.com/doc/current/components/serializer.html)
+> -- [The Symfony documentation](https://symfony.com/doc/current/components/serializer.html)
Unlike Symfony itself, API Platform leverages custom normalizers, its router and the [data provider](data-providers.md) system to perform an advanced transformation. Metadata are added to the generated document including links, type information, pagination data or available filters.
@@ -41,6 +41,107 @@ feature of the Symfony Serializer component.
In addition to groups, you can use any option supported by the Symfony Serializer. For example, you can use [`enable_max_depth`](https://symfony.com/doc/current/components/serializer.html#handling-serialization-depth)
to limit the serialization depth.
+[codeSelector]
+
+```php
+ 'read', 'enable_max_depth' => true],
+ denormalizationContext: ['groups' => ['write']],
+)]
+class Book
+{
+ #[Groups(["read", "write"])]
+ public $name;
+
+ #[Groups("write")]
+ #[MaxDepth(1)]
+ public $author;
+
+ // ...
+}
+```
+
+```yaml
+# api/config/api_platform/resources.yaml
+resources:
+ App\Entity\Book:
+ attributes:
+ normalization_context:
+ groups: ['read']
+ enable_max_depth: true
+ denormalization_context:
+ groups: ['write']
+
+# api/config/serialization/Book.yaml
+App\Entity\Book:
+ properties:
+ author:
+ groups: ['write']
+ max_depth: 1
+```
+
+```xml
+
+
+
+
+
+
+
+
+ read
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+ write
+
+
+
+
+
+
+
+
+
+
+
+
+
+ write
+ 1
+
+
+
+```
+
+[/codeSelector]
+
+
### Configuration
Just like other Symfony and API Platform components, the Serializer component can be configured using annotations, XML