Azure SDK for Embedded C
Data Fields
az_json_writer Struct Reference

Provides forward-only, non-cached writing of UTF-8 encoded JSON text into the provided buffer. More...

#include <az_json.h>

Data Fields

int32_t total_bytes_written
 
az_span destination_buffer
 The destination to write the JSON into.
 
int32_t bytes_written
 The bytes written in the current destination buffer.
 
az_span_allocator_fn allocator_callback
 Allocator used to support non-contiguous buffer as a destination.
 
void * user_context
 
bool need_comma
 A state to remember when to emit a comma between JSON array and object elements.
 
az_json_token_kind token_kind
 
_az_json_bit_stack bit_stack
 
az_json_writer_options options
 A copy of the options provided by the user.
 

Detailed Description

Provides forward-only, non-cached writing of UTF-8 encoded JSON text into the provided buffer.

Remarks
az_json_writer builds the text sequentially with no caching and by default adheres to the JSON RFC: https://tools.ietf.org/html/rfc8259.

Field Documentation

◆ bit_stack

_az_json_bit_stack az_json_writer::bit_stack

The current state of the writer based on the last JSON container it is in (whether array or object), used for validating the correctness of the JSON being written, and so it doesn't overflow the maximum supported depth.

◆ token_kind

az_json_token_kind az_json_writer::token_kind

The current state of the writer based on the last token written, used for validating the correctness of the JSON being written.

◆ total_bytes_written

int32_t az_json_writer::total_bytes_written

The total number of bytes written by the az_json_writer to the output destination buffer(s). This read-only field tracks the number of bytes of JSON written so far, and it shouldn't be modified by the caller.

◆ user_context

void* az_json_writer::user_context

Any struct that was provided by the user for their specific implementation, passed through to the az_span_allocator_fn.


The documentation for this struct was generated from the following file: