serializeJsonTree#

Fully qualified name: omni::structuredlog::serializeJsonTree

Defined in omni/structuredlog/JsonTreeSerializer.h

template<bool validate = false, typename JsonSerializerType = JsonSerializer<validate, false, ignoreJsonTreeSerializerValidationError>, typename JsonNodeType = JsonNode, typename BlobReaderType = BlobReader<validate, ignoreJsonTreeSerializerValidationError>>
static inline bool omni::structuredlog::serializeJsonTree(
JsonSerializerType *serial,
const JsonNodeType *root,
const void *blob,
size_t blobSize,
)#

Serialize JSON using a JsonNode as the schema and a binary blob to read data.

This function exists specifically to support structured log serialization within omni.structuredlog and is tailored to that use case. The interface and implementation details are subject to change as needed by omni.structuredlog.

Parameters:
  • serial[inout] The JSON serializer to serialize the data into.

  • root[in] The JSON tree to use for the data schema.

  • blob[in] The binary blob to read data directly from.

  • blobSize[in] The length of blob in bytes.

Template Parameters:
  • validate – If this is true, validation will be performed. This ensures the output JSON will be valid. This also will add bounds checking onto blob. If this is false, out of bounds reading is possible when the blob was generated incorrectly.

  • prettyPrint – If this is set to false, the output will be printed with minimal spacing. Human-readable spacing will be used otherwise.

  • onValidationError – This callback will be used when a validation error occurs, so that logging can be performed.

Returns:

true if no validation error occurred.

Returns:

false if any form of validation error occurred.