json -package:beam-postgres

Set the body of the response to the JSON encoding of the given value. Also sets "Content-Type" header to "application/json; charset=utf-8" if it has not already been set.
Set the body of the response to the JSON encoding of the given value. Also sets "Content-Type" header to "application/json; charset=utf-8" if it has not already been set.
Support for serialising Haskell to and from JSON JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. This library provides a parser and pretty printer for converting between Haskell values and JSON.
Decoder of the JSON values into a JSON AST.
Encoder of JSON values from JSON AST.
Parse any JSON value. The conversion of a parsed value to a Haskell value is deferred until the Haskell value is needed. This may improve performance if only a subset of the results of conversions are needed, but at a cost in thunk allocation. This function is an alias for value. In aeson 0.8 and earlier, it parsed only object or array types, in conformance with the now-obsolete RFC 4627.

Warning

If an object contains duplicate keys, only the first one will be kept. For a more flexible alternative, see jsonWith.
Generate a Json display.
A QuasiQuoter for constructing JSON values. The constructed value is polymorph and unifies to instances of FromValue. When used as a ResponseMatcher it matches a response with
  • a status code of 200
  • a Content-Type header with value application/json
  • the specified JSON as response body
When used as a ByteString it creates a ByteString from the specified JSON that can be used as a request body for e.g. POST and PUT requests. Example:
>>> L.putStrLn [json|[23, {foo: 42}]|]
[23,{"foo":42}]
Extremely simple JSON helper. Don't do anything too fancy with this!
Functions for serializing the Pandoc AST to JSON and deserializing from JSON. Example of use: The following script (capitalize.hs) reads reads a JSON representation of a Pandoc document from stdin, and writes a JSON representation of a Pandoc document to stdout. It changes all regular text in the document to uppercase, without affecting URLs, code, tags, etc. Run the script with
pandoc -t json | runghc capitalize.hs | pandoc -f json
or (making capitalize.hs executable)
pandoc --filter ./capitalize.hs
#!/usr/bin/env runghc
import Text.Pandoc.JSON
import Data.Char (toUpper)

main :: IO ()
main = toJSONFilter capitalizeStrings

capitalizeStrings :: Inline -> Inline
capitalizeStrings (Str s) = Str $ map toUpper s
capitalizeStrings x       = x
Serialising Haskell values to and from JSON values.
The class of types serialisable to and from JSON