> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For full documentation content, see https://docs.nvidia.com/nemo/relay/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Module convert

> Conversion utilities between C strings/JSON and Rust types.

Generated from `cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi`.

Conversion utilities between C strings/JSON and Rust types.

All functions in this module handle null pointers gracefully and use thread-local error storage for failure reporting.

## Functions

* [c\_str\_to\_json](/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-c-str-to-json): Parse a null-terminated C string as JSON. Returns `None` on error and sets last\_error.
* [c\_str\_to\_opt\_json](/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-c-str-to-opt-json): Parse a null-terminated C string to an optional JSON value. Returns `Ok(None)` for null pointers, `Ok(Some(v))` for valid JSON.
* [c\_str\_to\_string](/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-c-str-to-string): Parse a C string to a Rust String. Returns Err status on failure.
* [json\_to\_c\_string](/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-json-to-c-string): Convert a JSON value to a library-owned C string. The caller must free with `nemo_relay_string_free`.
* [nemo\_relay\_string\_free](/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-nemo-relay-string-free): Free a C string previously returned by any `nemo_relay_*` accessor function. Passing null is a safe no-op.
* [str\_to\_c\_string](/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-str-to-c-string): Convert a Rust \&str to a library-owned C string.
* [unix\_micros\_to\_opt\_timestamp](/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-unix-micros-to-opt-timestamp): Parse an optional Unix timestamp in microseconds since epoch to UTC.