json is:exact
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.
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}]