json is:module

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.
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.
A collection of convenience functions for using and parsing JSON values within WD. All monadic parse errors are converted to asynchronous BadJSON exceptions. These functions are used internally to implement webdriver commands, and may be useful for implementing non-standard commands.
Functions which give precise syntax highlighting info in JSON format.
Encoding stuff into JSON values in TCM
Avro supports a JSON representation of Avro objects alongside the Avro binary format. An Avro schema can be used to generate and validate JSON representations of Avro objects. The JSON format is the same format as used for default values in schemas except unions are encoded differently. Non-union values are encoded as follows: TODO: table (Table from the Avro 1.8.2 specification: https://avro.apache.org/docs/1.8.2/spec.html#schema_record) Bytes and fixed are encoded as JSON strings where each byte is translated into the corresponding Unicode codepoint between 0–255, which includes non-printable characters. Note that this encoding happens at the Unicode code-point level, meaning it is independent of text encoding. (JSON is, by definition, encoded in UTF8.) Unions are encoded as an object with a single field that specifies the "branch" of the union. If the branch is a primitive type like "string", the name of the primitive type is used:
{ "string" : "foo" }
For named types (record, enum and fixed), the name of the type is used:
{ MyRecord : { ... } }
Encoding and decoding UTF-8 JSON content. This module is a thin wrapper around the most excellent aeson library, which has rich and powerful facilities for encoding Haskell types into JSON. Quite often, however, you find yourself having to create a Haskell type just to read some JSON coming from an external web service or API. This can be challenging when the source of the JSON is complex or varying its schema over time. For ease of exploration this module simply defines an easy to use intermediate type representing JSON as a format. Often you'll be working with literals directly in your code. While you can write:
j = JsonObject (intoMap [(JsonKey "answer", JsonNumber 42)])
and it would be correct, enabling:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-}
allows you to write:
j = JsonObject [("answer", 42)]
which you is somewhat less cumbersome in declaration-heavy code. You're certainly welcome to use the constructors if you find it makes for more readable code or if you need the type annotations.
Hackage-specific wrappers around the Util.JSON module
Expectations on JSON Values Semantics: TODO: table
Minimal JSON / RFC 7159 support The API is heavily inspired by aeson's API but puts emphasis on simplicity rather than performance. The ToJSON instances are intended to have an encoding compatible with aeson's encoding.
Encoding of ekg metrics as JSON. The encoding defined by the functions in this module are standardized and used by the ekg web UI. The purpose of this module is to let other web servers and frameworks than the one used by the ekg package expose ekg metrics.