BDE 4.14.0 Production release
|
Provide a utility for decoding JSON data into simple types.
This component provides a struct
of utility functions, baljsn::ParserUtil
, for decoding data in the JSON format into a bdeat
Simple type. The primary method is getValue
, which decodes into a specified object and is overloaded for all bdeat
Simple types.
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 de-serialize some JSON data into an object.
First, we define a struct, Employee
, to contain the data:
Then, we create an Employee
object:
Next, we specify the string values in JSON format used to represent the object data. Note that the birth date is specified in the ISO 8601 format:
Now, we use the created string refs to populate the employee object:
Finally, we will verify that the values are as expected: