aeson-value-qq: QuasiQuoter for Aeson.Value

[ bsd2, library, unclassified ] [ Propose Tags ] [ Report a vulnerability ]

See README.markdown


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0
Change log CHANGELOG.markdown
Dependencies aeson, attoparsec, attoparsec-aeson, base (>=4.7 && <5), bytestring, ghc-hs-meta, scientific, template-haskell, text, unordered-containers, vector [details]
Tested with ghc ==9.8.4
License BSD-2-Clause
Copyright 2026 Matvey Aksenov
Author Matvey Aksenov
Maintainer matvey.aksenov@gmail.com
Uploaded by MatveyAksenov at 2026-04-05T08:56:13Z
Home page https://github.com/supki/aeson-value-qq#readme
Bug tracker https://github.com/supki/aeson-value-qq/issues
Source repo head: git clone https://github.com/supki/aeson-value-qq
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-04-05 [all 1 reports]

Readme for aeson-value-qq-1.0.0

[back to package description]

aeson-value-qq provides a QuasiQuoter that creates aeson Values using JSON-like syntax.
It's a sister package of aeson-match-qq

aeson-qq is a very similar package. The main differences (as far as I can say) are:

  • we use aeson-attoparsec's parsers (specifically, jstring and scientific) where possible

  • we don't support variable object keys (that is, the {$key: 42} notation); I'm not exactly opposed to that feature but I don't really like how it looks and never had the need for it. It would also require adding FromJSONKey support and I would then have to support it in aeson-match-qq as well; in the end it's just too much work, man.

  • we use ghc-hs-meta instead of haskell-src-meta to parse Haskell expressions

Syntax

Copy-pasting JSON should always work (assuming infinite RAM).
Besides that, there are syntax extensions such as:

Bare keys

It's often possible to omit quotes around keys that include neither whitespace
nor characters used as part of JSON syntax:

[qq|
  { foo: 4
  , snake-case: "hello"
  }
|]

The bare-keys support is best-effort, so if your keys are weird, err on the side of quoting them.

Comments

If for some reason you'd like to document what you're doing, you can add comments:

[qq|
  # .foo works better when it's 7 not 4
  { foo: 7
  }
|]

Interpolation

We use ghc-hs-meta to parse Haskell inside #{...} syntax.

[qq|
  { foo: #{4 + 7}
  }
|]

Note that #{...} uses the Haskell language extensions enabled in the current module.