BDE 4.14.0 Production release
|
Provide a utility for encoding simple types in the JSON format.
This component provides a struct
of utility functions, baljsn::PrintUtil
, for encoding a bdeat
Simple type in the JSON format. The primary method is printValue
, which encodes a specified object and is overloaded for all bdeat
Simple types. The following table describes the format in which various Simple types are encoded.
Refer to the details of the JSON encoding format supported by this utility in the package documentation file (doc/baljsn.txt).
This section illustrates intended use of this component.
Suppose we want to serialize some data into JSON.
First, we define a struct, Employee
, to contain the data:
Then, we create an Employee
object and populate it with data:
Now, we create an output stream and manually construct the JSON string using baljsn::PrintUtil
:
Finally, we print out the JSON string:
The output should look like: