aeson-utils-0.2.1: Utilities for working with Aeson.

Safe HaskellNone

Data.Aeson.Utils

Contents

Description

This module provides a few small functions to make working with aeson easier. Hopefully at some point they won't be needed anymore.

Synopsis

Documentation

module Data.Aeson

Parsing values

decodeV :: FromJSON a => ByteString -> Maybe aSource

Deserialize any JSON value. Allows atomic values on the top level

eitherDecodeV :: FromJSON a => ByteString -> Either String aSource

Like decodeV, but returns an error message when decoding fails.

Utilities

fromFloatDigits :: RealFloat a => a -> Scientific

Efficient and exact conversion from a RealFloat into a Scientific number.

(.=?) :: ToJSON a => Text -> Maybe a -> Maybe PairSource

Optionally create a Pair.

parseNumber :: Scientific -> Either Integer DoubleSource

Convert a Scientific into an Integer if it doesn't have decimal points, otherwise to a Double.