Std.Json
View source →Exact, typed JSON for Cure.
JSON numbers retain their lexical category and normalized exact spelling. Decoding a number into an application type is performed by that type's literal protocol implementation; the JSON layer never routes through Float.
Types
-
type Number = NaturalNumber | IntegerNumber | DecimalNumber -
type Value = Null | Boolean | Number | String | Array | Object -
type DecodeError = InvalidSyntax | UnexpectedValue | InvalidNumber -
type ParseResult = Parsed | ParseFailure
Functions
-
# fn decode(source: String) -> Result(Value, DecodeError)
-
# fn decode_as(source: String) -> Result(t, DecodeError)
-
# fn encode(value: Value) -> String
Render the structured tree entirely in Cure. Only principled character and numeric primitives used by the wider stdlib remain across the extern edge.
-
# fn member(key: String, value: Value) -> ObjectMember
-
# fn required_member(key: String, members: List(ObjectMember)) -> Result(Value, DecodeError)
-
# fn to_json(value: t) -> String