Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- toByteString :: Json -> ByteString
- data Json
- null :: Json
- bool :: Bool -> Json
- intNumber :: Int -> Json
- wordNumber :: Word -> Json
- doubleNumber :: Double -> Json
- scientificNumber :: Scientific -> Json
- textString :: Text -> Json
- scientificString :: Scientific -> Json
- array :: Foldable f => f Json -> Json
- object :: Foldable f => f (Text, Json) -> Json
ByteString
toByteString :: Json -> ByteString Source #
Render a JSON value into strict bytestring.
Json
Specification of how to render a JSON value to ByteString
.
A sort of a JSON-specialized string ByteString
builder.
You can construct it by using the specialized
conversion functions from Haskell types.
After constructing, you can convert to strict ByteString
using the toByteString
function.
Primitives
Numbers
wordNumber :: Word -> Json Source #
JSON Number literal from Word
.
doubleNumber :: Double -> Json Source #
JSON Number literal from Double
.
Since JSON doesn't have support for them,
non-real values like NaN
, Infinity
, -Infinity
get rendered as 0
.
scientificNumber :: Scientific -> Json Source #
JSON Number literal from Scientific
.
Strings
textString :: Text -> Json Source #
JSON String literal from Text
.
scientificString :: Scientific -> Json Source #
JSON String literal from Scientific
.
You may need this when the reader of your JSON cannot handle large number literals.