json-bytes-builder-0.5.2.1: Direct-to-bytes JSON Builder

Safe HaskellNone
LanguageHaskell2010

JSONBytesBuilder.Builder

Contents

Description

DSL for construction of JSON.

Synopsis

Literal builders

data Literal Source #

Builder of any JSON literal.

null :: Literal Source #

JSON Null literal.

boolean :: Bool -> Literal Source #

JSON Boolean literal from Bool.

numberFromInt :: Int -> Literal Source #

JSON Number literal from Int.

numberFromInteger :: Integer -> Literal Source #

JSON Number literal from Integer.

numberFromDouble :: Double -> Literal Source #

JSON Number literal from Double.

numberFromScientific :: Scientific -> Literal Source #

JSON Number literal from Scientific.

stringFromText :: Text -> Literal Source #

JSON String literal from Text encoded using UTF8.

stringFromLazyText :: Text -> Literal Source #

JSON String literal from lazy Text encoded using UTF8.

stringFromBytes :: ByteString -> Literal Source #

JSON String literal from ByteString with only escaping applied to it.

stringFromLazyBytes :: ByteString -> Literal Source #

JSON String literal from lazy ByteString with only escaping applied to it.

object :: Rows -> Literal Source #

JSON Object literal from the Rows builder.

objectFromRows :: [Rows] -> Literal Source #

JSON Object literal from a list of rows. A convienience shortcut to object . mconcat for typical cases.

array :: Elements -> Literal Source #

JSON Array literal from the Elements builder.

arrayFromLiterals :: [Literal] -> Literal Source #

JSON Array literal from a list of element literals. A convienience shortcut to array . foldMap element for typical cases.

Rows builders

data Rows Source #

Builder of JSON Object rows.

Instances
Semigroup Rows Source # 
Instance details

Defined in JSONBytesBuilder.Private.Builder

Methods

(<>) :: Rows -> Rows -> Rows #

sconcat :: NonEmpty Rows -> Rows #

stimes :: Integral b => b -> Rows -> Rows #

Monoid Rows Source # 
Instance details

Defined in JSONBytesBuilder.Private.Builder

Methods

mempty :: Rows #

mappend :: Rows -> Rows -> Rows #

mconcat :: [Rows] -> Rows #

row :: Text -> Literal -> Rows Source #

Rows builder from a key-value pair, where value is an already encoded JSON literal.

Use the Rows Monoid instance to construct multi-row objects.

Elements builders

data Elements Source #

Builder of JSON Array elements.

element :: Literal -> Elements Source #

Elements builder from an element, which is an already encoded JSON literal.

Use the Elements Monoid instance to construct multi-element arrays.