Utilities for working with Aeson.

Version on this page:
LTS Haskell 16.31:
Stackage Nightly 2020-08-03:
Latest on Hackage:

See all snapshots aeson-utils appears in

BSD-3-Clause licensed by Silk. B.V.
Maintained by
This version can be pinned in stack with:aeson-utils-,958

Module documentation for

  • Data
    • Data.Aeson
      • Data.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



  • Allow attoparsec 0.12.*

  • Deprecate parseNumber in favor of Data.Scientific.floatingOrInteger
  • Re-export Data.Scientific.floatingOrInteger

  • Allow scientific 0.3.*