-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathDecode.purs
More file actions
19 lines (16 loc) · 778 Bytes
/
Decode.purs
File metadata and controls
19 lines (16 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Data.Argonaut.Decode
( fromJsonString
, module Data.Argonaut.Decode.Class
, module Data.Argonaut.Decode.Combinators
, module Data.Argonaut.Decode.Error
, module Data.Argonaut.Decode.Parser
) where
import Prelude
import Data.Argonaut.Decode.Class (class DecodeJson, decodeJson)
import Data.Argonaut.Decode.Combinators (getField, getFieldOptional, getFieldOptional', defaultField, (.:), (.:!), (.:?), (.!=))
import Data.Argonaut.Decode.Error (JsonDecodeError'(..), printJsonDecodeError')
import Data.Argonaut.Decode.Parser (parseJson)
import Data.Either (Either)
-- | Parse and decode a json in one step.
fromJsonString :: forall customErr json. DecodeJson json => String -> Either (JsonDecodeError' customErr) json
fromJsonString = parseJson >=> decodeJson