json -package:json

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.
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}]
DataType for JSON. See PgJSON for more information
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
Filter operators for JSON values added to PostgreSQL 9.4
This module contains PostgreSQL-specific JSON functions. A couple of things to keep in mind about this module:
  • The Type column in the PostgreSQL documentation tables are the types of the right operand, the left is always jsonb.
  • Since these operators can all take NULL values as their input, and most can also output NULL values (even when the inputs are guaranteed to not be NULL), all JSONB values are wrapped in Maybe. This also makes it easier to chain them. (cf. JSONBExpr) Just use the just function to lift any non-Maybe JSONB values in case it doesn't type check.
  • As long as the previous operator's resulting value is a JSONBExpr, any other JSON operator can be used to transform the JSON further. (e.g. [1,2,3] -> 1 @> 2)
The PostgreSQL version the functions work with are included in their description.