@@ -629,6 +629,35 @@ all the properties of the class::
629
629
// ...
630
630
}
631
631
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
+
632
661
Serializing to or from PHP Arrays
633
662
---------------------------------
634
663
0 commit comments