Skip to content

Commit a3ab202

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: Rewords [Serializer] [JsonStreamer] Add streaming JSON documentation
2 parents 0dbb2ae + 18fd48c commit a3ab202

File tree

2 files changed

+693
-0
lines changed

2 files changed

+693
-0
lines changed

serializer.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,35 @@ all the properties of the class::
629629
// ...
630630
}
631631

632+
Serializing JSON Using Streams
633+
------------------------------
634+
635+
Symfony can encode PHP data structures to JSON streams and decode JSON streams
636+
back into PHP data structures.
637+
638+
To do this, it relies on the :doc:`JsonStreamer component </serializer/streaming_json>`,
639+
which is designed for high efficiency and can process large JSON data incrementally,
640+
without needing to load the entire content into memory.
641+
642+
When deciding between the Serializer component and the JsonStreamer component,
643+
consider the following:
644+
645+
* **Serializer Component**: Best suited for use cases that require flexibility,
646+
such as dynamically manipulating object structures using normalizers and
647+
denormalizers, or handling complex objects with multiple serialization
648+
formats. It also supports output formats beyond JSON (including your own
649+
custom ones).
650+
* **JsonStreamer Component**: Best suited for simple objects and scenarios that
651+
demand high performance and low memory usage. It's particularly effective
652+
for processing very large JSON datasets or when streaming JSON in real-time
653+
without loading the entire dataset into memory.
654+
655+
The choice depends on your specific use case. The JsonStreamer component is
656+
tailored for performance and memory efficiency, whereas the Serializer
657+
component provides greater flexibility and broader format support.
658+
659+
Read more about :doc:`streaming JSON </serializer/streaming_json>`.
660+
632661
Serializing to or from PHP Arrays
633662
---------------------------------
634663

0 commit comments

Comments
 (0)