omni::structuredlog::serializeJsonTree
Defined in omni/structuredlog/JsonTreeSerializer.h
-
template<bool validate = false, typename JsonSerializerType = JsonSerializer<false, false, ignoreJsonTreeSerializerValidationError>, typename JsonNodeType = JsonNode, typename BlobReaderType = BlobReader<false, 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.
- 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.