Configuration

This is the default configuration of the middleware. When any of the settings shall be modified, it shall be done in dedicated application config lwjson_opts.h file.

Note

Check Getting started for guidelines on how to create and use configuration file.

group LWJSON_OPT

LwJSON options.

Defines

LWJSON_CFG_REAL_TYPE

Real data type used to parse numbers with floating point number.

This is used for numbers in LWJSON_TYPE_NUM_REAL token data type.

Note

Data type must be signed, normally float or double

LWJSON_CFG_INT_TYPE

Integer type used to parse numbers.

This is used for numbers in LWJSON_TYPE_NUM_INT token data type.

Note

Data type must be signed integer

LWJSON_CFG_COMMENTS

Enables 1 or disables 0 support for inline comments.

Default set to 0 to be JSON compliant

LWJSON_MEMSET(dst, val, len)

Memory set function.

Note

Function footprint is the same as memset

LWJSON_MEMCPY(dst, src, len)

Memory copy function.

Note

Function footprint is the same as memcpy

JSON streaming confiuration.

Defines

LWJSON_CFG_STREAM_KEY_MAX_LEN

Max length of token key (object key name) to be available for stack storage.

Size this value (and keep it <= LWJSON_CFG_STREAM_STRING_MAX_LEN) large enough for every key name you expect to receive.

Note

Key names longer than this value are not correctly captured during the parsing No error is returned in either case:

  • If the key still fits in a single LWJSON_CFG_STREAM_STRING_MAX_LEN chunk (buffer used during parsing), the name is silently truncated to its first LWJSON_CFG_STREAM_KEY_MAX_LEN characters. This is done during copy to stack

  • If the key is longer to span more than one chunk of stream string max length, the stored name ends up holding only the last chunk - not a valid prefix of the key.

LWJSON_CFG_STREAM_STACK_SIZE

Max stack size (depth) in units of lwjson_stream_stack_t structure.

LWJSON_CFG_STREAM_STRING_MAX_LEN

Max size of string for single parsing in units of bytes.

LWJSON_CFG_STREAM_PRIMITIVE_MAX_LEN

Max number of bytes used to parse primitive.

Primitives are all numbers and logical values (null, true, false)

JSON serialization configuration.

Defines

LWJSON_CFG_SERIALIZER_MAX_STACK_DEPTH

Maximum depth for nested objects and arrays.

LWJSON_CFG_SERIALIZER_USE_64BIT

Enables 1 or disables 0 64-bit integer serializer APIs.

Set to 0 on targets without 64-bit integer support. In that mode, serializer integer APIs use int32_t and uint32_t.