Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

JSON quasiquatation for Haskell

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 COPYING.txt
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Setup.hs
Octocat-spinner-32 text-json-qq.cabal


JSON quasiquatation for Haskell.

This package expose the function jsonQQ that compile time converts json code into a Text.JSON.JSValue. jsonQQ got the signature

jsonQQ :: QuasiQuoter

and is used like

myCode = [jsonQQ| {age: 23, name: "Pelle", likes: ["mac","Haskell"] } |]

where it is important that

  • you got no space in [jsonQQ| and
  • no additional code after |].

The quasiquatation can also bind to variables like

myCode = [jsonQQ | {age: <| age |>, name: <| name |>} |]
 where age = 34 :: Integer
       name = "Pelle"

or contain Haskell code like

myCode = [jsonQQ | {age: <| age + 42 :: Integer |>, name: <| map toUpper name |>} |]
 where age = 34 :: Integer
       name = "Pelle"
Something went wrong with that request. Please try again.