aeson-injector-1.0.5.1: Injecting fields into aeson values

Copyright(c) Anton Gushcha, 2016
LicenseMIT
Maintainerncrashed@gmail.com
Stabilityexperimental
PortabilityPortable
Safe HaskellNone
LanguageHaskell2010

Data.Aeson.Unit

Description

Common problem in REST interfaces when you need to return nothing as result, usage of `()` will produce `[]` JSON. That causes problems in some JSON parsers in other languages.

So, Unit serialises into empty JSON object:

>>> encode Unit
"{}"

Synopsis

Documentation

data Unit Source

Data type that serialise into empty object in aeson

>>> encode Unit
"{}"
>>> encode $ toSchema (Proxy :: Proxy Unit)
"{\"type\":\"object\"}"

Also the FromJSON instance is just `pure Unit`, so it never fails.

Constructors

Unit