kata_json

Types

pub type JsonError {
  ParseError(message: String)
  SchemaError(errors: List(error.Error))
}

Constructors

  • ParseError(message: String)

    JSON parse error

  • SchemaError(errors: List(error.Error))

    Schema validation error

Values

pub fn decode_json(
  schema: schema.Schema(a),
  input: String,
) -> Result(a, JsonError)

Decode a JSON string using a schema.

pub fn encode_json(schema: schema.Schema(a), value: a) -> String

Encode a value to a JSON string using a schema.

pub fn parse(input: String) -> Result(value.Value, String)

Parse a JSON string into a Value (schema-independent).

pub fn serialize(v: value.Value) -> String

Serialize a Value to a JSON string (schema-independent).

Search Document