- data JSValue
- class JSON a where
- parseJSON :: ByteString -> Either String JSValue
- readJSON :: ByteString -> Maybe JSValue
- showJSON :: JSValue -> ByteString
- getField :: JSON a => ByteString -> JSValue -> Maybe a
- getFields :: JSON a => [ByteString] -> JSValue -> Maybe a
- updateField :: JSON a => ByteString -> a -> JSValue -> JSValue
Class and Data-Types for JSON Value
Data types for JSON value.
Type Class for the value that can be converted from/into JSValue
.
Parsing & Printing
showJSON :: JSValue -> ByteStringSource
Print JSValue
as JSON source (not pretty).
Manipulating Objects
getField :: JSON a => ByteString -> JSValue -> Maybe aSource
Get the value for field in Object and decode it.
getFields :: JSON a => [ByteString] -> JSValue -> Maybe aSource
Same as getField
but it can process nested Object. ex:
getFeilds ["user", "name"] (JSObject [("user", JSObject [("name", JSString "hoge")])]) == Just "hoge"
updateField :: JSON a => ByteString -> a -> JSValue -> JSValueSource
Update or Insert the value for field in Object.