gaato/sdk-runtime/json does not have a README file
pub struct ObjBuilder {
// private fields
}test {
let builder = @json.ObjBuilder::new()
.field("name", "sample")
.opt("count", (None : Int?))
.presence("note", (@json.Null : @json.Presence[String]))
assert_eq(builder.build(), { "name": "sample", "note": null })
}fn[T : ToJson] ObjBuilder::presence(self : ObjBuilder, key : String, value : Presence[T]) -> ObjBuildertest {
let value = @json.Presence::from_option(Some(3))
assert_eq(value.map(n => n + 1).to_option(), Some(4))
assert_false(value.is_absent())
}fn[T : FromJson] field(obj : Map[String, Json], key : String, path : JsonPath) -> T raise JsonDecodeErrorfn[T] open_int(json : Json, path : JsonPath, known : (Int) -> T?, unknown : (Int) -> T) -> T raise JsonDecodeErrorfn[T] open_string(json : Json, path : JsonPath, known : (String) -> T?, unknown : (String) -> T) -> T raise JsonDecodeErrorfn[T : FromJson] opt_field(obj : Map[String, Json], key : String, path : JsonPath) -> T? raise JsonDecodeErrorInstall
Download zipAPI-agnostic client runtime for MoonBit SDKs: error taxonomy, Retry-After and backoff, tri-state JSON fields, open enums. Built on gaato/http; no async runtime dependency.
Dependencies