# mco_lJSON_arr_add_uint
RT

### Prototype

        MCO_RET mco_lJSON_arr_add_uint(lews_JSON_context_h json_ctx, mco_uint8 value);

### Arguments

`json_ctx`
Pointer to an initialized `lews_JSON_context_t` structure.
`value`
Unsigned 64-bit integer value to be added as an element to the current JSON array (`mco_uint8` in this API denotes a 64-bit type).

### Description

> This function appends an unsigned numeric value to the current JSON array (e.g., adds `42` or `18446744073709551615` as an array element).

> The value is converted to its decimal string representation and inserted without quotes, as required by the JSON standard.

> The function may trigger a buffer flush and send data over the network if there is insufficient space in the output buffer to write the formatted number.

> This function can only be called when the current context is inside a JSON array. Attempting to call it at the root level or inside a JSON object will result in an error.

>         ...
>         ret = mco_lJSON_obj_open_arr(&json_ctx, "values");
>         if (ret == MCO_S_OK) {
>             ret = mco_lJSON_arr_add_uint(&json_ctx, 42);
>             if (ret != MCO_S_OK) {
>                 printf("mco_lJSON_arr_add_uint error %d\n", ret);
>             }
>             ret = mco_lJSON_arr_add_uint(&json_ctx, 43);
>             if (ret != MCO_S_OK) {
>                 printf("mco_lJSON_arr_add_uint error %d\n", ret);
>             }
>             ret = mco_lJSON_obj_close(&json_ctx);
>             if (ret != MCO_S_OK) {
>                 printf("mco_lJSON_obj_close error %d\n", ret);
>             }
>         }
>         ...

### Return Codes

`MCO_S_OK`
Unsigned numeric value successfully added to the current JSON array.
`MCO_E_NW_SENDERR`
An error occurred while flushing the output buffer due to insufficient space for the formatted number.
`MCO_E_LEWS_PARENT_IS_NOT_ARRAY`
The current parent context is not a JSON array (e.g., you are at the root level or inside an object).
Other error codes
May indicate internal errors (e.g., invalid arguments, null pointers).

### Files

Header file:
mcoewslite.h
Source file:
mcoewslite.c
Library:
mcoewslite.a