|
|
|
|
|
Description |
JSON utility functions.
|
|
Synopsis |
|
|
|
|
JSON-related functions
|
|
type JSRecord = [(String, JSValue)] | Source |
|
A type alias for the list-based representation of J.JSObject.
|
|
fromJResult :: Monad m => String -> Result a -> m a | Source |
|
Converts a JSON Result into a monadic value.
|
|
readEitherString :: Monad m => JSValue -> m String | Source |
|
Tries to read a string from a JSON value.
In case the value was not a string, we fail the read (in the
context of the current monad.
|
|
|
:: Monad m | | => String | Input message
| -> String | | -> m [JSObject JSValue] | | Converts a JSON message into an array of JSON objects.
|
|
|
|
Reads the value of a key in a JSON object.
|
|
maybeFromObj :: (JSON a, Monad m) => JSRecord -> String -> m (Maybe a) | Source |
|
Reads the value of an optional key in a JSON object.
|
|
fromObjWithDefault :: (JSON a, Monad m) => JSRecord -> String -> a -> m a | Source |
|
Reads the value of a key in a JSON object with a default if missing.
|
|
|
:: (JSON a, Monad m) | | => String | The value to read
| -> JSValue | | -> m a | | Reads a JValue, that originated from an object key.
|
|
|
fromJVal :: (Monad m, JSON a) => JSValue -> m a | Source |
|
Small wrapper over readJSON.
|
|
asJSObject :: Monad m => JSValue -> m (JSObject JSValue) | Source |
|
Converts a JSON value into a JSON object.
|
|
asObjectList :: Monad m => [JSValue] -> m [JSObject JSValue] | Source |
|
Coneverts a list of JSON values into a list of JSON objects.
|
|
|
:: JSON a | | => String | The object array
| -> JSRecord | The desired key from the object
| -> String | | -> Result a | | Try to extract a key from a object with better error reporting
than fromObj.
|
|
|
toArray :: Monad m => JSValue -> m [JSValue] | Source |
|
Ensure a given JSValue is actually a JSArray.
|
|
Produced by Haddock version 2.6.0 |