BDE 4.14.0 Production release
|
Provide options for decoding JSON into a Datum
object.
Datum
This component provides a single, simply constrained (value-semantic) attribute class, baljsn::DatumDecoderOptions
, that is used to specify options for decoding Datum
objects in the JSON format (see baljsn::DatumUtil
).
maxNestedDepth
: the maximum depth to which JSON objects and arrays are allowed to be nested before the JSON decoder reports an error. For example, if maxNestedDepth
is 8, and a JSON text has 9 consecutive open brackets ([
) the decoding will return an error. This option can be used to prevent poorly formed, or malicious JSON text from causing a stack overflow.This section illustrates intended use of this component.
This component is designed to be used at a higher level to set the options for decoding Datum
objects in the JSON format. This example shows how to create and populate an options object.
First, we default-construct a baljsn::DatumDecoderOptions
object:
Finally, we populate that object to limit the maximum nested depth using a pre-defined limit: