Module json

Module json 

Source
Expand description

JSON utilities with optional SIMD acceleration

This module provides JSON parsing and serialization utilities that can use SIMD-accelerated parsing when the simd-json feature is enabled.

§Performance

When the simd-json feature is enabled, JSON parsing can be 2-4x faster for large payloads. This is particularly beneficial for API servers that handle large JSON request bodies.

§Usage

The module provides drop-in replacements for serde_json functions:

use rustapi_core::json;

// Deserialize from bytes (uses simd-json if available)
let value: MyStruct = json::from_slice(&bytes)?;

// Serialize to bytes
let bytes = json::to_vec(&value)?;

Enums§

JsonError
JSON error type that wraps both serde_json and simd-json errors.

Functions§

from_slice
Deserialize JSON from a byte slice.
from_slice_mut
Deserialize JSON from a mutable byte slice.
to_vec
Serialize a value to a JSON byte vector.
to_vec_pretty
Serialize a value to a pretty-printed JSON byte vector.
to_vec_with_capacity
Serialize a value to a JSON byte vector with pre-allocated capacity.