jasper

Types

pub type Indentation {
  Spaces(Int)
  Tab
  Tabs(Int)
}

Constructors

  • Spaces(Int)
  • Tab
  • Tabs(Int)
pub type JsonQuery {
  Root
  Key(query: JsonQuery, key: String)
  KeyOr(query: JsonQuery, key: String, or: JsonValue)
  Index(query: JsonQuery, index: Int)
  IndexOr(query: JsonQuery, index: Int, or: JsonValue)
  Filter(query: JsonQuery, predicate: fn(JsonValue) -> Bool)
  Map(query: JsonQuery, mapping: fn(JsonValue) -> JsonValue)
  MapKeys(query: JsonQuery, mapping: fn(String) -> String)
  MapValues(
    query: JsonQuery,
    mapping: fn(String, JsonValue) -> JsonValue,
  )
  FilterMap(
    query: JsonQuery,
    mapping: fn(JsonValue) -> Result(JsonValue, Nil),
  )
  ForEach(query: JsonQuery)
  ForEachOk(query: JsonQuery)
}

Constructors

pub type JsonQueryError {
  UnexpectedType(JsonValue)
  MissingObjectKey(JsonValue, key: String)
  IndexOutOfBounds(JsonValue, index: Int)
}

Constructors

pub type JsonValue {
  Object(dict.Dict(String, JsonValue))
  Array(List(JsonValue))
  String(String)
  Int(Int)
  Float(Float)
  Bool(Bool)
  Null
}

Constructors

Values

pub fn parse(
  value: String,
) -> Result(JsonValue, json.DecodeError)
pub fn parse_bits(
  value: BitArray,
) -> Result(JsonValue, json.DecodeError)
pub fn query(
  json: JsonValue,
  query: JsonQuery,
) -> Result(JsonValue, JsonQueryError)
pub fn to_json(value: JsonValue) -> json.Json
pub fn to_pretty_string(
  value: JsonValue,
  indentation: Indentation,
) -> String
pub fn to_pretty_string_tree(
  value: JsonValue,
  indentation: Indentation,
) -> string_tree.StringTree
pub fn to_string(value: JsonValue) -> String
Search Document