BloombergLP::baljsn::JsonFormatter_Util::valueAsJson

Load the JSON representation of value into the specified json.

Synopsis

Declared in <baljsn_jsonformatter.h>

template<class TYPE>
static
int
valueAsJson(
    bdljsn::Json* json,
    TYPE const& value,
    EncoderOptions const* options);

Description

Optionally use the specified options. Return 0 on success and a non-zero value otherwise.

Specializations

NameDescription
valueAsJson<Date> Load the JSON representation of the Date value into json.
valueAsJson<DateTz> Load the JSON representation of the DateTz value into json.
valueAsJson<Datetime> Load the JSON representation of the Datetime value into json.
valueAsJson<DatetimeTz> Load the JSON representation of the DatetimeTz value into json.
valueAsJson<Decimal_Type64> Load the JSON representation of the Decimal64 value into json.
valueAsJson<Time> Load the JSON representation of the Time value into json.
valueAsJson<TimeTz> Load the JSON representation of the TimeTz value into json.
valueAsJson<double> Load the JSON representation of the double value into json.
valueAsJson<float> Load the JSON representation of the float value into json.
valueAsJson<basic_string<char>> Load the JSON representation of the bsl::string value into json.

Return Value

0 on success and a non-zero value otherwise

Parameters

NameDescription
jsonJSON object to receive the encoded value
valuevalue to encode as JSON
optionsoptional encoding options; null uses defaults