Skip to content

Commit b225879

Browse files
committed
minor #20486 [JsonEncoder] [JsonStreamer] Add streaming JSON documentation (mtarld)
This PR was merged into the 7.3 branch. Discussion ---------- [JsonEncoder] [JsonStreamer] Add streaming JSON documentation Fixes #20461, #20708, #20676, #20598, #20572 Commits ------- 297146e [Serializer] [JsonStreamer] Add streaming JSON documentation
2 parents ccab4bf + 297146e commit b225879

File tree

2 files changed

+707
-0
lines changed

2 files changed

+707
-0
lines changed

serializer.rst

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

632+
Serializing JSON using streams
633+
------------------------------
634+
635+
Symfony is able of encoding PHP data structures to JSON streams and decoding
636+
JSON streams back into PHP data structures.
637+
638+
To do so, it relies on the JsonStreamer component, which is designed for high
639+
efficiency and can process large JSON data incrementally without needing to
640+
load the entire content into memory.
641+
642+
When deciding between the :doc:`Serializer component <serializer>` and the
643+
JsonStreamer component, consider the following:
644+
645+
- **Serializer Component**: Ideal for scenarios requiring flexibility, such as
646+
dynamically manipulating object shapes using normalizers and denormalizers,
647+
or handling complex objects which multiple serialization representation.
648+
Plus, it allows working with formats beyond JSON (and even with a custom
649+
format of yours).
650+
651+
- **JsonStreamer Component**: Ideal for simple objects and tasks that
652+
demand high performance and minimal memory usage. It's particularly
653+
effective when processing very large JSON datasets or in scenarios that
654+
require streaming JSON in real-time without loading the entire dataset
655+
into memory.
656+
657+
Choosing between the two depends on your specific use case requirements.
658+
The JsonStreamer component is tailored to optimize for performance and memory
659+
efficiency, while the Serializer component offers flexibility and broader
660+
format support.
661+
662+
Read more about streaming JSON in :doc:`/serializer/streaming_json`.
663+
632664
Serializing to or from PHP Arrays
633665
---------------------------------
634666

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy