lemma/serialization/mod.rs
1//! Serialization: Lemma values ↔ JSON.
2//!
3//! **Input (deserialization):** JSON → string fact values for evaluation.
4//!
5//! - [`from_json`] parses JSON and converts each value to a string for
6//! `ExecutionPlan::with_values()`.
7//! - null values are skipped (treated as "fact not provided").
8//!
9//! **Output (serialization):** Lemma evaluation results → JSON.
10//!
11//! - [`literal_value_to_json`] converts a `LiteralValue` to `(serde_json::Value, Option<unit>)`
12//! for use in API/CLI responses.
13//!
14//! # Example (input)
15//!
16//! ```ignore
17//! use lemma::serialization::from_json;
18//!
19//! let json = br#"{"discount": 21, "config": {"key": "value"}, "name": null}"#;
20//! let values = from_json(json)?;
21//! let plan = execution_plan.with_values(values, &limits)?;
22//! ```
23//!
24//! # Example (output)
25//!
26//! ```ignore
27//! use lemma::serialization::literal_value_to_json;
28//!
29//! let (json_value, unit) = literal_value_to_json(&literal_value);
30//! ```
31
32mod json;
33
34pub use json::from_json;
35pub use json::literal_value_to_json;
36pub use json::{
37 deserialize_fact_path_set, deserialize_resolved_fact_value_map, serialize_fact_path_set,
38 serialize_resolved_fact_value_map,
39};