Data.Argonaut 
- Package
 - purescript-argonaut
 - Repository
 - purescript-contrib/purescript-argonaut
 
Re-exports from Data.Argonaut.Core  
#stringifyWithIndent Source
stringifyWithIndent :: Int -> Json -> StringConverts a Json value to a JSON string.
The first Int argument specifies the amount of white space characters to use as indentation.
This number is capped at 10 (if it is greater, the value is just 10). Values less than 1 indicate that no space should be used.
#jsonSingletonObject Source
jsonSingletonObject :: String -> Json -> JsonConstructs a Json object value containing only the provided key and value
#jsonSingletonArray Source
jsonSingletonArray :: Json -> JsonConstructs a Json array value containing only the provided value
#jsonEmptyString Source
jsonEmptyString :: JsonAn empty string represented as Json
#jsonEmptyObject Source
jsonEmptyObject :: JsonAn empty object represented as Json
#jsonEmptyArray Source
jsonEmptyArray :: JsonAn empty array represented as Json
#fromString Source
fromString :: String -> JsonConstruct the Json representation of a String value.
Note that this function only produces Json containing a single piece of String
data (similar to fromBoolean, fromNumber, etc.).
This function does NOT convert the String encoding of a JSON value to Json - For that
purpose, you'll need to use jsonParser.
#fromNumber Source
fromNumber :: Number -> JsonConstruct Json from a Number value
#fromBoolean Source
fromBoolean :: Boolean -> JsonConstruct Json from a Boolean value
#caseJsonString Source
caseJsonString :: forall a. a -> (String -> a) -> Json -> aA simpler version of caseJson which accepts a callback for when the
Json argument was a String, and a default value for all other cases.
#caseJsonObject Source
caseJsonObject :: forall a. a -> (Object Json -> a) -> Json -> aA simpler version of caseJson which accepts a callback for when the
Json argument was an Object, and a default value for all other cases.
#caseJsonNumber Source
caseJsonNumber :: forall a. a -> (Number -> a) -> Json -> aA simpler version of caseJson which accepts a callback for when the
Json argument was a Number, and a default value for all other cases.
#caseJsonNull Source
caseJsonNull :: forall a. a -> (Unit -> a) -> Json -> aA simpler version of caseJson which accepts a callback for when the
Json argument was null, and a default value for all other cases.
#caseJsonBoolean Source
caseJsonBoolean :: forall a. a -> (Boolean -> a) -> Json -> aA simpler version of caseJson which accepts a callback for when the
Json argument was a Boolean, and a default value for all other cases.
#caseJsonArray Source
caseJsonArray :: forall a. a -> (Array Json -> a) -> Json -> aA simpler version of caseJson which accepts a callback for when the
Json argument was a Array Json, and a default value for all other cases.
Re-exports from Data.Argonaut.Decode  
#JsonDecodeError Source
data JsonDecodeErrorError type for failures while decoding.
Constructors
TypeMismatch StringUnexpectedValue JsonAtIndex Int JsonDecodeErrorAtKey String JsonDecodeErrorNamed String JsonDecodeErrorMissingValue
Instances
#DecodeJson Source
class DecodeJson a  whereMembers
decodeJson :: Json -> Either JsonDecodeError a
Instances
(DecodeJson a) => DecodeJson (Identity a)(DecodeJson a) => DecodeJson (Maybe a)(DecodeJson a, DecodeJson b) => DecodeJson (Tuple a b)(DecodeJson a, DecodeJson b) => DecodeJson (Either a b)DecodeJson UnitDecodeJson BooleanDecodeJson NumberDecodeJson IntDecodeJson StringDecodeJson NonEmptyStringDecodeJson Json(DecodeJson a) => DecodeJson (NonEmpty Array a)(DecodeJson a) => DecodeJson (NonEmptyArray a)(DecodeJson a) => DecodeJson (NonEmpty List a)(DecodeJson a) => DecodeJson (NonEmptyList a)DecodeJson CodePoint(DecodeJson a) => DecodeJson (Object a)(DecodeJson a) => DecodeJson (Array a)(DecodeJson a) => DecodeJson (List a)(Ord a, DecodeJson a) => DecodeJson (Set a)(Ord a, DecodeJson a, DecodeJson b) => DecodeJson (Map a b)DecodeJson Void(GDecodeJson row list, RowToList row list) => DecodeJson (Record row)
#printJsonDecodeError Source
printJsonDecodeError :: JsonDecodeError -> StringPrints a JsonDecodeError as a readable error message.
#parseJson Source
parseJson :: String -> Either JsonDecodeError JsonAttempt to parse a string as Json, failing with a typed error if the
JSON string is malformed.
#getFieldOptional' Source
getFieldOptional' :: forall a. DecodeJson a => Object Json -> String -> Either JsonDecodeError (Maybe a)Attempt to get the value for a given key on an Object Json.
The result will be Right Nothing if the key and value are not present,
or if the key is present and the value is null.
Use this accessor if the key and value are optional in your object.
If the key and value are mandatory, use getField (.:) instead.
#getFieldOptional Source
getFieldOptional :: forall a. DecodeJson a => Object Json -> String -> Either JsonDecodeError (Maybe a)Attempt to get the value for a given key on an Object Json.
The result will be Right Nothing if the key and value are not present,
but will fail if the key is present but the value cannot be converted to the right type.
This function will treat null as a value and attempt to decode it into your desired type.
If you would like to treat null values the same as absent values, use
getFieldOptional' (.:?) instead.
#getField Source
getField :: forall a. DecodeJson a => Object Json -> String -> Either JsonDecodeError aAttempt to get the value for a given key on an Object Json.
Use this accessor if the key and value must be present in your object.
If the key and value are optional, use getFieldOptional' (.:?) instead.
#defaultField Source
defaultField :: forall a. Either JsonDecodeError (Maybe a) -> a -> Either JsonDecodeError aHelper for use in combination with .:? to provide default values for optional
Object Json fields.
Example usage:
newtype MyType = MyType
  { foo :: String
  , bar :: Maybe Int
  , baz :: Boolean
  }
instance decodeJsonMyType :: DecodeJson MyType where
  decodeJson json = do
    x <- decodeJson json
    foo <- x .: "foo" -- mandatory field
    bar <- x .:? "bar" -- optional field
    baz <- x .:? "baz" .!= false -- optional field with default value of `false`
    pure $ MyType { foo, bar, baz }
#(.:?) Source
Operator alias for Data.Argonaut.Decode.Combinators.getFieldOptional' (non-associative / precedence 7)
#(.:!) Source
Operator alias for Data.Argonaut.Decode.Combinators.getFieldOptional (non-associative / precedence 7)
#(.:) Source
Operator alias for Data.Argonaut.Decode.Combinators.getField (non-associative / precedence 7)
#(.!=) Source
Operator alias for Data.Argonaut.Decode.Combinators.defaultField (non-associative / precedence 6)
Re-exports from Data.Argonaut.Encode  
#EncodeJson Source
class EncodeJson a  whereMembers
encodeJson :: a -> Json
Instances
(EncodeJson a) => EncodeJson (Identity a)(EncodeJson a) => EncodeJson (Maybe a)(EncodeJson a, EncodeJson b) => EncodeJson (Tuple a b)(EncodeJson a, EncodeJson b) => EncodeJson (Either a b)EncodeJson UnitEncodeJson BooleanEncodeJson NumberEncodeJson IntEncodeJson StringEncodeJson JsonEncodeJson CodePointEncodeJson NonEmptyString(EncodeJson a) => EncodeJson (NonEmpty Array a)(EncodeJson a) => EncodeJson (NonEmptyArray a)(EncodeJson a) => EncodeJson (NonEmpty List a)(EncodeJson a) => EncodeJson (NonEmptyList a)EncodeJson Char(EncodeJson a) => EncodeJson (Array a)(EncodeJson a) => EncodeJson (List a)(EncodeJson a) => EncodeJson (Object a)(Ord a, EncodeJson a) => EncodeJson (Set a)(Ord a, EncodeJson a, EncodeJson b) => EncodeJson (Map a b)EncodeJson Void(GEncodeJson row list, RowToList row list) => EncodeJson (Record row)
#extendOptional Source
extendOptional :: forall a. EncodeJson a => Maybe (Tuple String Json) -> a -> JsonThe named Encoders of the (~>?) operator.
#assocOptional Source
assocOptional :: forall a. EncodeJson a => String -> Maybe a -> Maybe (Tuple String Json)The named Encoders of the (:=?) operator.
#(~>?) Source
Operator alias for Data.Argonaut.Encode.Combinators.extendOptional (right-associative / precedence 6)
Optionally extends a Json object with an optional Tuple String Json property.
#(~>) Source
Operator alias for Data.Argonaut.Encode.Combinators.extend (right-associative / precedence 6)
Extends a Json object with a Tuple String Json property.
#(:=?) Source
Operator alias for Data.Argonaut.Encode.Combinators.assocOptional (non-associative / precedence 7)
Creates an optional Tuple String Json entry, representing an optional
key/value pair for an object.
#(:=) Source
Operator alias for Data.Argonaut.Encode.Combinators.assoc (non-associative / precedence 7)
Creates a Tuple String Json entry, representing a key/value pair for
an object.
Re-exports from Data.Argonaut.JCursor  
#primToJson Source
primToJson :: JsonPrim -> Json#inferEmpty Source
inferEmpty :: JCursor -> JsonRe-exports from Data.Argonaut.Parser  
#jsonParser Source
jsonParser :: String -> Either String JsonParse a JSON string, constructing the Json value described by the string.
To convert a string into a Json string, see fromString.
Re-exports from Data.Argonaut.Prisms  
Re-exports from Data.Argonaut.Traversals  
- Modules
 - Data.
Argonaut