Module json

Module json 

Source
Expand description

JSON Module (STD-003)

Thin wrappers around serde_json for Ruchy-friendly API.

§Examples

use ruchy::stdlib::json;

// Parse JSON string
let value = json::parse(r#"{"name": "Alice", "age": 30}"#)?;

// Access fields
let name = json::get(&value, "name");
let name_str = json::as_string(name.unwrap());

// Stringify back to JSON
let json_str = json::stringify(&value)?;

// Pretty print
let pretty = json::pretty(&value)?;

Enums§

Value
Represents any valid JSON value.

Functions§

as_bool
Convert a JSON value to a bool
as_f64
Convert a JSON value to an f64
as_i64
Convert a JSON value to an i64
as_string
Convert a JSON value to a Rust string
get
Get a field from a JSON object
get_index
Get an element from a JSON array by index
get_path
Get a nested field from a JSON object using a path
parse
Parse a JSON string into a Value
pretty
Convert a Value to a pretty-printed JSON string
stringify
Convert a Value to a JSON string