jasper

Types

pub type JsonArray =
  List(JsonValue)
pub type JsonObject =
  Dict(String, JsonValue)
pub type JsonParseError {
  UnexpectedToken(found: Char)
  UnexpectedEndOfInput
}

Constructors

  • UnexpectedToken(found: Char)
  • UnexpectedEndOfInput
pub type JsonQuery {
  Root
  Key(JsonQuery, key: String)
  Index(JsonQuery, index: Int)
}

Constructors

  • Root
  • Key(JsonQuery, key: String)
  • Index(JsonQuery, index: Int)
pub type JsonQueryError {
  UnexpectedType(JsonValue)
  MissingObjectKey(JsonValue, key: String)
  IndexOutOfBounds(JsonValue, index: Int)
}

Constructors

  • UnexpectedType(JsonValue)
  • MissingObjectKey(JsonValue, key: String)
  • IndexOutOfBounds(JsonValue, index: Int)
pub type JsonValue {
  Object(JsonObject)
  Array(JsonArray)
  String(String)
  Number(Float)
  Boolean(Bool)
  Null
}

Constructors

  • Object(JsonObject)
  • Array(JsonArray)
  • String(String)
  • Number(Float)
  • Boolean(Bool)
  • Null

Functions

pub fn parse_json(
  value: String,
) -> Result(JsonValue, JsonParseError)
pub fn query_json(
  json: JsonValue,
  query: JsonQuery,
) -> Result(JsonValue, JsonQueryError)
Search Document