Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Extensions |
|
Synopsis
- atKey :: Text -> (Value -> Decoder a) -> Object -> Decoder a
- atKeyOptional :: Text -> (Value -> Decoder a) -> Object -> Decoder (Maybe a)
- atKeyStrict :: Text -> (Value -> Decoder a) -> Object -> Decoder a
- atPointer :: Text -> (Value -> Decoder a) -> Decoder a
- bool :: Value -> Decoder Bool
- char :: Value -> Decoder Char
- double :: Value -> Decoder Double
- int :: Value -> Decoder Int
- list :: (Value -> Decoder a) -> Value -> Decoder [a]
- nullable :: (Value -> Decoder a) -> Value -> Decoder (Maybe a)
- objectAsKeyValues :: (Text -> Decoder k) -> (Value -> Decoder v) -> Value -> Decoder [(k, v)]
- scientific :: Value -> Decoder Scientific
- string :: Value -> Decoder String
- text :: Value -> Decoder Text
- listOfDouble :: Value -> Decoder [Double]
- listOfInt :: Value -> Decoder [Int]
- isNull :: Value -> Decoder Bool
- withArray :: (Array -> Decoder a) -> Value -> Decoder a
- withBool :: (Bool -> Decoder a) -> Value -> Decoder a
- withDocumentValue :: (Value -> Decoder a) -> InputBuffer -> Decoder a
- withDouble :: (Double -> Decoder a) -> Value -> Decoder a
- withInt :: (Int -> Decoder a) -> Value -> Decoder a
- withObject :: (Object -> Decoder a) -> Value -> Decoder a
- withRawByteString :: (ByteString -> Decoder a) -> Value -> Decoder a
- withString :: (String -> Decoder a) -> Value -> Decoder a
- withText :: (Text -> Decoder a) -> Value -> Decoder a
Documentation
atKey :: Text -> (Value -> Decoder a) -> Object -> Decoder a Source #
Find an object field by key, where an exception is thrown if the key is missing.
atKeyOptional :: Text -> (Value -> Decoder a) -> Object -> Decoder (Maybe a) Source #
Find an object field by key, where Nothing is returned if the key is missing.
atKeyStrict :: Text -> (Value -> Decoder a) -> Object -> Decoder a Source #
Uses find_field, which means if you access a field out-of-order this will throw an exception. It also cannot support optional fields.
atPointer :: Text -> (Value -> Decoder a) -> Decoder a Source #
Decode a value at the particular JSON pointer following RFC 6901. Be careful where you use this because it rewinds the document on each successive call.
list :: (Value -> Decoder a) -> Value -> Decoder [a] Source #
Parse a homogenous JSON array into a Haskell list.
nullable :: (Value -> Decoder a) -> Value -> Decoder (Maybe a) Source #
Transforms a parser to return Nothing when the value is null.
:: (Text -> Decoder k) | Parses a Text key in the Decoder monad. JSON keys are always text. |
-> (Value -> Decoder v) | Decoder for the field value. |
-> Value | |
-> Decoder [(k, v)] |
Parse an object into a homogenous list of key-value tuples.
scientific :: Value -> Decoder Scientific Source #
Parse a Scientific from a Value.
string :: Value -> Decoder String Source #
Parse a JSON string into a Haskell String.
For best performance you should use text
instead.
listOfDouble :: Value -> Decoder [Double] Source #
Is more efficient by looping in C++ instead of Haskell.
withArray :: (Array -> Decoder a) -> Value -> Decoder a Source #
Helper to work with an Array parsed from a Value.
withBool :: (Bool -> Decoder a) -> Value -> Decoder a Source #
Helper to work with a Bool parsed from a Value.
withDocumentValue :: (Value -> Decoder a) -> InputBuffer -> Decoder a Source #
Parse the given input into a document iterator, get its Value, which is either a JSON object or an array, and run the given action on that Value.
withDouble :: (Double -> Decoder a) -> Value -> Decoder a Source #
Helper to work with a Double parsed from a Value.
withInt :: (Int -> Decoder a) -> Value -> Decoder a Source #
Helper to work with an Int parsed from a Value.
withObject :: (Object -> Decoder a) -> Value -> Decoder a Source #
Helper to work with an Object parsed from a Value.
withRawByteString :: (ByteString -> Decoder a) -> Value -> Decoder a Source #
Helper to work with the raw ByteString of the JSON token parsed from the given Value.