interface Encoder : Type -> Type Abstraction over JSON value encoding.
Parameters: v
Methods:
stringify : v -> String Converts the intermediary data representation
to a JSON string.
string : String -> v Encodes a `String` value.
double : Double -> v Encodes a `Double` as a JSON `Double`.
integer : Integer -> v Encodes a `Double` as a JSON `Integer`.
boolean : Bool -> v Encodes a `Bool` as a JSON `Boolean`.
array : List v -> v Encodes a `List` of values as a JSON `Array`.
object : List (String, v) -> v Encodes a `List` key-value pairs as a JSON `Object`
null : v
Implementation: Encoder JSON
stringify : Encoder v => v -> String Converts the intermediary data representation
to a JSON string.
Visibility: public exportstring : Encoder v => String -> v Encodes a `String` value.
Visibility: public exportdouble : Encoder v => Double -> v Encodes a `Double` as a JSON `Double`.
Visibility: public exportinteger : Encoder v => Integer -> v Encodes a `Double` as a JSON `Integer`.
Visibility: public exportboolean : Encoder v => Bool -> v Encodes a `Bool` as a JSON `Boolean`.
Visibility: public exportarray : Encoder v => List v -> v Encodes a `List` of values as a JSON `Array`.
Visibility: public exportobject : Encoder v => List (String, v) -> v Encodes a `List` key-value pairs as a JSON `Object`
Visibility: public exportnull : Encoder v => v- Visibility: public export
interface Object : Type -> Type -> Type Abstraction over JSON Object representation for decoding.
It is important that `obj` is the type that guides interface
resolution here, otherwise operators like `.:` cannot conveniently
be used, since Idris needs additional guidance to resolve interfaces.
Parameters: obj, v
Methods:
lookup : String -> obj -> Maybe v pairs : obj -> List (String, v)
Implementation: Object (List (String, JSON)) JSON
lookup : Object obj v => String -> obj -> Maybe v- Visibility: public export
pairs : Object obj v => obj -> List (String, v)- Visibility: public export
interface Value : Type -> Type -> Type Abstraction over JSON value representation for decoding.
Parameters: v, obj
Constraints: Object obj v
Methods:
typeOf : v -> String Returns the actual value. This should be one of
"String", "Null", "Object", "Number", "Boolean", or "Array".
However, other types are possible as well, as this is
only used for error messages when something goes wrong.
parse : Origin -> String -> Either (ParseError Void) v Tries to convert a string to an intermediare value.
getObject : v -> Maybe obj Tries to convert a value to an `Object`.
getArray : v -> Maybe (List v) Tries to convert a value to an `Array` of values.
getBoolean : v -> Maybe Bool Tries to convert a value to a `Boolean`.
getDouble : v -> Maybe Double Tries to convert a value to a `Double`.
getInteger : v -> Maybe Integer Tries to convert a value to an `Integer`.
getString : v -> Maybe String Tries to convert a value to a `String`.
isNull : v -> Bool `True`, if the value in question is `null`.
Implementation: Value JSON (List (String, JSON))
typeOf : Value v obj => v -> String Returns the actual value. This should be one of
"String", "Null", "Object", "Number", "Boolean", or "Array".
However, other types are possible as well, as this is
only used for error messages when something goes wrong.
Visibility: public exportparse : Value v obj => Origin -> String -> Either (ParseError Void) v Tries to convert a string to an intermediare value.
Visibility: public exportgetObject : Value v obj => v -> Maybe obj Tries to convert a value to an `Object`.
Visibility: public exportgetArray : Value v obj => v -> Maybe (List v) Tries to convert a value to an `Array` of values.
Visibility: public exportgetBoolean : Value v obj => v -> Maybe Bool Tries to convert a value to a `Boolean`.
Visibility: public exportgetDouble : Value v obj => v -> Maybe Double Tries to convert a value to a `Double`.
Visibility: public exportgetInteger : Value v obj => v -> Maybe Integer Tries to convert a value to an `Integer`.
Visibility: public exportgetString : Value v obj => v -> Maybe String Tries to convert a value to a `String`.
Visibility: public exportisNull : Value v obj => v -> Bool `True`, if the value in question is `null`.
Visibility: public exportgetArrayN : Value v obj => (n : Nat) -> v -> Maybe (Vect n v)- Visibility: public export