Module

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.

#JBoolean Source

type JBoolean = Boolean

A Boolean value inside some JSON data. Note that this type is exactly the same as the primitive Boolean type; this synonym acts only to help indicate intent.

#JNumber Source

type JNumber = Number

A Number value inside some JSON data. Note that this type is exactly the same as the primitive Number type; this synonym acts only to help indicate intent.

#JString Source

type JString = String

A String value inside some JSON data. Note that this type is exactly the same as the primitive String type; this synonym acts only to help indicate intent.

#JArray Source

type JArray = Array Json

A JSON array; an array containing Json values.

#JObject Source

type JObject = StrMap Json

A JSON object; a JavaScript object containing Json values.

#JNull Source

data JNull :: Type

The type of null values inside JSON data. There is exactly one value of this type: in JavaScript, it is written null. This module exports this value as jsonNull.

Instances

#Json Source

data Json :: Type

The type of JSON data. The underlying representation is the same as what would be returned from JavaScript's JSON.parse function; that is, ordinary JavaScript booleans, strings, arrays, objects, etc.

Instances

#foldJson Source

foldJson :: forall a. (JNull -> a) -> (JBoolean -> a) -> (JNumber -> a) -> (JString -> a) -> (JArray -> a) -> (JObject -> a) -> Json -> a

Case analysis for Json values. See the README for more information.

#foldJsonNull Source

foldJsonNull :: forall a. a -> (JNull -> a) -> Json -> a

A simpler version of foldJson which accepts a callback for when the Json argument was null, and a default value for all other cases.

#foldJsonBoolean Source

foldJsonBoolean :: forall a. a -> (JBoolean -> a) -> Json -> a

A simpler version of foldJson which accepts a callback for when the Json argument was a Boolean, and a default value for all other cases.

#foldJsonNumber Source

foldJsonNumber :: forall a. a -> (JNumber -> a) -> Json -> a

A simpler version of foldJson which accepts a callback for when the Json argument was a Number, and a default value for all other cases.

#foldJsonString Source

foldJsonString :: forall a. a -> (JString -> a) -> Json -> a

A simpler version of foldJson which accepts a callback for when the Json argument was a String, and a default value for all other cases.

#foldJsonArray Source

foldJsonArray :: forall a. a -> (JArray -> a) -> Json -> a

A simpler version of foldJson which accepts a callback for when the Json argument was a JArray, and a default value for all other cases.

#foldJsonObject Source

foldJsonObject :: forall a. a -> (JObject -> a) -> Json -> a

A simpler version of foldJson which accepts a callback for when the Json argument was a JObject, and a default value for all other cases.

#isBoolean Source

#fromNull Source

#fromBoolean Source

#fromNumber Source

#fromString Source

#fromArray Source

#fromObject Source

#jsonNull Source

#jsonTrue Source

#jsonFalse Source

#jsonZero Source

#jsonEmptyString Source

#jsonEmptyArray Source

#jsonEmptyObject Source

#jsonSingletonArray Source

#jsonSingletonObject Source

#stringify Source