|
BDE 4.39.x Production Release
|
Provide a utility to get simple types from bdl::json objects.
Provide a utility to get simple types from bdl::json objects
bdljsn::JsonsThis component provides a struct of utility functions, baljsn::JsonParserUtil, for extracting data from bdljsn::Json objects format into a bdlat Simple type. The primary method is getValue which is is overloaded for all bdlat Simple types.
This section illustrates intended use of this component.
Suppose we want extract some data from bdljsn::Json objects.
First, we define a struct, Employee, to contain the data:
Then, we create an Employee object:
Next, we create bdljsn::Json objects of different (dynameic) types having the data of interest. Note that the string data does not have embedden double quote deliminters as required in JSON documents. Also note that the date information is represented in ISO 8601 format in a string.
Now, we use bdljsn::Json objects to populate the employee object:
Finally, we will verify that the values are as expected: