aeson-utils: Utilities for working with Aeson.

[ bsd3, data, library ] [ Propose Tags ]

Utilities for working with Aeson.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.2.1, 0.2.1.1, 0.2.2.0, 0.2.2.1, 0.3, 0.3.0.1, 0.3.0.2
Change log CHANGELOG.md
Dependencies aeson (>=0.6 && <0.8), attoparsec (>=0.10 && <0.12), base (>=4 && <5), bytestring (>=0.9 && <0.11), scientific (>=0.2 && <0.4), text (>=0.11 && <1.2) [details]
License BSD-3-Clause
Copyright 2014, Silk B.V
Author Silk. B.V.
Maintainer code@silk.co
Category Data
Source repo head: git clone https://github.com/silkapp/aeson-utils.git
Uploaded by AdamBergmark at 2014-05-15T23:33:55Z
Distributions
Reverse Dependencies 4 direct, 4 indirect [details]
Downloads 10351 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed [all 1 reports]

Readme for aeson-utils-0.2.1.1

[back to package description]

aeson-utils

Build Status

A small package containing helpful addititions to aeson.

It provides eitherDecodeV and decodeV functions (analogous to eitherDecode and decode in aeson) that can be used to parse atomic JSON values at the top level. This is not strictly valid JSON, only objects and arrays are allowed at the top level in the specification, but aeson's encode allows this already. This gives us the nice property decodeV . encode = Just.

The package also contains the .=? operator that you can use to optionally construct object pairs:

object (
  [ "a" .= foo
  , "b" .= bar
  ] ++ catMaybes
  [ "c" .=? mBaz
  , "d" .=? mQux
  ])

Finally it has a parseNumber function that converts a scientific into Either Integer Double in case you want to distinguish between integrals and fractionals.

Installation instructions

aeson-utils is available on hackage

cabal install aeson-utils