Data.Argonaut.Core
- Package
- purescript-argonaut-core
- Repository
- purescript-contrib/purescript-argonaut-core
This module defines a data type and various functions for creating and manipulating JSON values. The README contains additional documentation for this module.
#caseJsonNull Source
caseJsonNull :: forall a. a -> (Unit -> a) -> Json -> a
A 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 -> a
A simpler version of caseJson
which accepts a callback for when the
Json
argument was a Boolean
, and a default value for all other cases.
#caseJsonNumber Source
caseJsonNumber :: forall a. a -> (Number -> a) -> Json -> a
A simpler version of caseJson
which accepts a callback for when the
Json
argument was a Number
, and a default value for all other cases.
#caseJsonString Source
caseJsonString :: forall a. a -> (String -> a) -> Json -> a
A simpler version of caseJson
which accepts a callback for when the
Json
argument was a String
, and a default value for all other cases.
#caseJsonArray Source
caseJsonArray :: forall a. a -> (Array Json -> a) -> Json -> a
A 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.
#caseJsonObject Source
caseJsonObject :: forall a. a -> (Object Json -> a) -> Json -> a
A simpler version of caseJson
which accepts a callback for when the
Json
argument was an Object
, and a default value for all other cases.
#fromBoolean Source
fromBoolean :: Boolean -> Json
Construct Json
from a Boolean
value
#fromNumber Source
fromNumber :: Number -> Json
Construct Json
from a Number
value
#fromString Source
fromString :: String -> Json
Construct Json
from a String
value. If you would like to parse a string
of JSON into valid Json
, see jsonParser
.
#jsonEmptyString Source
jsonEmptyString :: Json
An empty string represented as Json
#jsonEmptyArray Source
jsonEmptyArray :: Json
An empty array represented as Json
#jsonSingletonArray Source
jsonSingletonArray :: Json -> Json
Constructs a Json
array value containing only the provided value
#jsonEmptyObject Source
jsonEmptyObject :: Json
An empty object represented as Json
#jsonSingletonObject Source
jsonSingletonObject :: String -> Json -> Json
Constructs a Json
object value containing only the provided key and value
#stringifyWithIndent Source
stringifyWithIndent :: Int -> Json -> String
Converts 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.