# mcorest_api_json_write_hex_string

Write binary data converted to hexadecimal string representation.

### For an overview see page mcorest_api_json_write_*

### Prototype

        MCO_RET mcorest_api_json_write_hex_string( mcorest_api_json_write_ctx_t *ctx,
                                    const void *data,
                                    size_t len);

### Arguments

ctx | Pointer to the JSON write context structure
data | Data array to be written in hex string format
len | The length of the data array to be written in hex string format

### Description

> This function writes binary data converted to hexadecimal string representation. If the string is NULL, writes null. This is a convenience wrapper for `mcorest_api_json_write_string_begin()`, `mcorest_api_json_write_hex_string_part()` and `mcorest_api_json_write_string_end()`.

### Return Codes

MCO_S_OK = 0 | Success
MCO_E_REST_* | Any of the Web Services Error Codes

### Example

        static void print_hex_string(mcorest_api_json_write_ctx_t *jctx,
                            const char *s)
        {
            mcorest_api_json_write_object_begin(jctx);
            mcorest_api_json_write_key(jctx, "hex_string_value");
            mcorest_api_json_write_hex_string(jctx, s, strlen(s));
            ...
            mcorest_api_json_write_object_end(jctx);
            ...
        }

### Files

Header file:
mcorestapi.h
Source file:
jsonwr.c
Library:
libmcorest.a