> For clean Markdown of any page, append .md to the page URL. For a task-oriented documentation index, fetch https://docs.nvidia.com/nemo/relay/llms.txt. Use the documentation version matching the installed NeMo Relay package: latest follows the latest stable release, vX.Y.Z identifies a retained release snapshot, and dev documents development changes. Preserve the selected version when following links; do not mix examples or API contracts from different versions. Fetch the relevant section's /llms.txt before individual pages instead of loading a complete version index. # Module convert > Conversion utilities between C strings/JSON and Rust types. Generated from `cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker`. 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_clone](/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-nemo-relay-string-clone): Copy a C string into Relay-owned storage for a callback result. Free the result with `nemo_relay_string_free`, or transfer it to Relay. Returns null for null input. * [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. ## Docs - [Function c_str_to_json](https://docs.nvidia.com/nemo/relay/v1.0.0/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-c-str-to-json.md): Parse a null-terminated C string as JSON. Returns `None` on error and sets last_error. - [Function c_str_to_opt_json](https://docs.nvidia.com/nemo/relay/v1.0.0/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-c-str-to-opt-json.md): Parse a null-terminated C string to an optional JSON value. Returns `Ok(None)` for null pointers, `Ok(Some(v))` for valid JSON. - [Function c_str_to_string](https://docs.nvidia.com/nemo/relay/v1.0.0/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-c-str-to-string.md): Parse a C string to a Rust String. Returns Err status on failure. - [Function json_to_c_string](https://docs.nvidia.com/nemo/relay/v1.0.0/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-json-to-c-string.md): Convert a JSON value to a library-owned C string. The caller must free with `nemo_relay_string_free`. - [Function nemo_relay_string_clone](https://docs.nvidia.com/nemo/relay/v1.0.0/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-nemo-relay-string-clone.md): Copy a C string into Relay-owned storage for a callback result. Free the result with `nemo_relay_string_free`, or transfer it to Relay. Returns null for null input. - [Function nemo_relay_string_free](https://docs.nvidia.com/nemo/relay/v1.0.0/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-nemo-relay-string-free.md): Free a C string previously returned by any `nemo_relay_*` accessor function. Passing null is a safe no-op. - [Function str_to_c_string](https://docs.nvidia.com/nemo/relay/v1.0.0/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-str-to-c-string.md): Convert a Rust &str to a library-owned C string. - [Function unix_micros_to_opt_timestamp](https://docs.nvidia.com/nemo/relay/v1.0.0/reference/api/rust-library-reference/nemo-relay-ffi/convert/fn-unix-micros-to-opt-timestamp.md): Parse an optional Unix timestamp in microseconds since epoch to UTC.