| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Sat, 17 Jan 2026 04:59:20 GMT
X-Served-By: cache-dfw-kdfw8210063-DFW, cache-bom-vanm7210050-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768625960.792088,VS0,VE385
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
aeson-quick: Quick JSON extractions with Aeson
[Skip to Readme]
aeson-quick: Quick JSON extractions with Aeson
Small DSL on top of Aeson for casual and concise JSON construction and deconstruction.
[Skip to Readme]
Downloads
- aeson-quick-0.2.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.1, 0.1.1.1, 0.1.1.2, 0.1.2.0, 0.1.2.1, 0.1.3, 0.2.0 |
|---|---|
| Change log | ChangeLog.md |
| Dependencies | aeson, attoparsec, base (>=4.7 && <5), deepseq, template-haskell, text, unordered-containers, vector [details] |
| License | BSD-3-Clause |
| Copyright | 2022 Scott Sadler |
| Author | Scott Sadler |
| Maintainer | scott@scottsadler.de |
| Uploaded | by ssadler at 2022-05-02T21:57:24Z |
| Category | JSON |
| Home page | https://github.com/ssadler/aeson-quick#readme |
| Bug tracker | https://github.com/ssadler/aeson-quick/issues |
| Source repo | head: git clone https://github.com/ssadler/aeson-quick |
| Distributions | NixOS:0.2.0 |
| Reverse Dependencies | 1 direct, 0 indirect [details] |
| Downloads | 4271 total (30 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs uploaded by user Build status unknown [no reports yet] |
Readme for aeson-quick-0.2.0
[back to package description]aeson-quick
aeson-quick is a small DSL on top of aeson for casual and concise JSON construction and deconstruction.
In essence, it allows you to remove the Objects in a json Value using a simple key lookup syntax, so that the FromJSON typeclass can do the rest of the work, and it can go the other way, too.
aeson-quick structures can be defined using the fromString instance, or using the QuasiQuoter quick for compile time validation, ie: [quick|{foo}|].
Syntax
Transformations
| Operation | Json Value | Quick expression | Haskell type |
|---|---|---|---|
| Parse any value | * |
. |
a |
| Key lookup | {"foo": *} |
{foo} |
a |
| Optional key | {} |
{foo?} |
Maybe a |
| Multiple keys | {"foo": *, "bar": *} |
{foo,bar} |
(a, b) |
| Nested object | {"foo": {"bar": *}} |
{foo:{bar}} |
b |
| Complex object | [{"foo": *, "bar": [*, *]}] |
[{a,b:[.]}] |
[(a, [c])] |
| Array | [*, *] |
[.] |
[a] |
| Array lookup (deconstruct only) | [*, *] |
[.]1 |
a |
| Array range (deconstruct only) | [*, *] |
[.]1- |
[a] |
Examples:
Deconstruction:
> let value = [jsonlit|{"foo": true, "bar": [0, 1], "baz": [{"foo": true}, {}, {"foo": false}]}|]
> value .! "{foo}" :: Bool
True
> value .! "{foo, bar}" :: (Bool, [Int])
(True, [0, 1])
> value .! "{baz:[{foo?}]}" :: [Maybe Bool]
[Just True, Nothing, Just False]
-- value is [1,2,3]
> value .! "[.]1" :: Int
2
> value .! "[.]1-" :: [Int]
[2,3]
> value .! "[.]0-2" :: [Int]
[1,2]
> value .! "[.]4" :: Maybe Int
Nothing
Construction:
> "." .% True
true
> "{foo}" .% True
{"foo": true}
> "[{foo}]" .% [1,2,3]
[{"foo":1},{"foo":2},{"foo":3}]
> "{foo:[{bar?}]}" .% [Just 1, Nothing]
{"foo":[{"bar":1},{}]}
Performance
Performance is extremely similar to using Aeson functions directly. See Writeup.md for more details.