aeson-match-qq: Declarative JSON matchers.

[ bsd2, library, web ] [ Propose Tags ]

See README.markdown

[Skip to Readme]


[Last Documentation]

  • Aeson
    • Match
      • Aeson.Match.QQ
        • Internal
          • Aeson.Match.QQ.Internal.Match
          • Aeson.Match.QQ.Internal.Parse
          • Aeson.Match.QQ.Internal.Value


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.6.0, 1.6.1, 1.7.0
Change log CHANGELOG.markdown
Dependencies aeson, attoparsec, base (>=4.14 && <5), bytestring, containers, either, haskell-src-meta, scientific, template-haskell, text, unordered-containers, vector [details]
License BSD-2-Clause
Copyright Matvey Aksenov 2022
Category Web
Home page
Bug tracker
Source repo head: git clone
Uploaded by MatveyAksenov at 2022-04-07T13:58:50Z
Distributions NixOS:1.7.0
Downloads 1836 total (39 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2022-04-07 [all 2 reports]

Readme for aeson-match-qq-1.3.1

[back to package description]


Build status

Declarative JSON matchers.


When testing an HTTP service that spouts JSON documents, it's often inconvenient to write out the whole response as the expected value. Sometimes, you only care about a couple specific properties, or simply want to ensure that the response has certain structure. This package provides a quasiquoter to define declarative matchers using a variation of the familiar syntax.


Basic JSON construction

Since this package is heavily inspired by aeson-qq, the parser tries to follow its behavior and has support for optional quotes for simple keys and the #{exp} syntax for Haskell expression interpolation. It currently does not support variable keys though and there are no plans to add them.

Spread-like syntax for arrays and objects

This syntax allows you to match only the part of the structure you care about:

[match| [1, 2, 3, ...] |] matches arrays starting with [1, 2, 3]
[match| {foo: 1, bar: 2, ...} |] matches objects that are supersets of {foo: 1, bar: 2}


Holes are placeholders that match anything:

[match| _ |] matches any JSON document
[match| {foo: _} |] matches any object that has the foo property.

If a hole is named, its value will be returned from match

[match| {foo: {bar: _n} |] will return {n: 4} if matched with {foo: {bar: 4}}