jelly
Types
From gleam/json
pub type DecodeError {
UnexpectedEndOfInput
UnexpectedByte(String)
UnexpectedSequence(String)
}
Constructors
-
UnexpectedEndOfInput
-
UnexpectedByte(String)
-
UnexpectedSequence(String)
Represents a JSON tree of arbitrary schema
pub type JsonType {
Unknown
Null
Bool(Bool)
Float(Float)
Int(Int)
String(String)
Array(List(JsonType))
Object(Dict(String, JsonType))
}
Constructors
-
Unknown
-
Null
-
Bool(Bool)
-
Float(Float)
-
Int(Int)
-
String(String)
-
Array(List(JsonType))
-
Object(Dict(String, JsonType))
Functions
pub fn decode(from value: Dynamic) -> JsonType
Decodes any Dynamic into a JsonType which can be matched on to extract the data. If decoding fails for a given property, Unknown is returned.
pub fn parse(from json: String) -> Result(JsonType, DecodeError)
pub fn path(
json: JsonType,
path: String,
) -> Result(JsonType, Nil)
Select a nested value from a JsonType object using a path expression (e.g. “a.b.c[3]”). Returns Nil if the path does not lead to a value.