en	= Serializing

en	Serialization is the process where a JSON document represented in memory by a <<ref_value>> is turned into a sequence of characters. The library provides the following free functions and types for serialization:

en	Name

en	Description

en	<<ref_operator_lt_lt>>

en	Serialize a <<ref_value>>, <<ref_array>>, <<ref_object>>, or <<ref_string>>

en	to a {std_ostream}.

en	<<ref_serialize>>

en	Return a {std_string} representing a serialized <<ref_value>>, <<ref_array>>,

en	<<ref_object>>, or <<ref_string>>.

en	<<ref_serializer>>

en	A stateful object which may be used to efficiently serialize one or more

en	instances of <<ref_value>>, <<ref_array>>, <<ref_object>>, or <<ref_string>>. |===

en	To facilitate debugging and ease of output, library container types may be written to standard output streams using the stream operator:

en	The <<ref_serialize>> function converts a <<ref_value>> into a {std_string}:

en	In situations where serializing a <<ref_value>> in its entirety is inefficient or even impossible, <<ref_serializer>> can be used to serialize a <<ref_value>> incrementally. This may be done for a variety of reasons, such as to avoid buffering the entire output, or to ensure that a fixed amount of work is performed in each cycle. Instances of <<ref_serializer>> maintain an output state using internal dynamically allocated structures, with an interface to retrieve successive buffers of the serialized output into a caller provided buffer. Here is an example, demonstrating how <<ref_operator_lt_lt>> may be implemented using a <<ref_serializer>>:

en	As with the parser, the serializer may be reused by calling <<ref_serializer_reset>>. This sets up the object to serialize a new instance and retains previously allocated memory. This can result in performance improvements when multiple variables are serialized.