Module

Data.Argonaut.Encode.Combinators

Package
purescript-argonaut-codecs
Repository
purescript-contrib/purescript-argonaut-codecs

Provides operators for a DSL to construct Json values:

myJson =
 "key1" := value1
   ~> "key2" :=? value2
   ~>? "key3" := value3
   ~> jsonEmptyObject

#(:=) 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.

#assoc Source

assoc :: forall a. EncodeJson a => String -> a -> Tuple String Json

The named Encoders of the (:=) operator.

#(:=?) 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.

#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.extend (right-associative / precedence 6)

Extends a Json object with a Tuple String Json property.

#extend Source

extend :: forall a. EncodeJson a => Tuple String Json -> a -> 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.

#extendOptional Source

extendOptional :: forall a. EncodeJson a => Maybe (Tuple String Json) -> a -> Json

The named Encoders of the (~>?) operator.