decodefunction complements the longstanding
encodefunction, and makes the API simpler.
🆕 New examples make it easier to learn to use the package (https://github.com/bos/aeson/tree/master/examples).
👍 Generics support
aeson's support for data-type generic programming makes it possible to use JSON encodings of most data types without writing any boilerplate instances.
Thanks to Bas Van Dijk,
aesonnow supports the two major schemes for doing datatype-generic programming:
the modern mechanism, built into GHC itself (http://www.haskell.org/ghc/docs/latest/html/users_guide/generic-programming.html)
the older mechanism, based on SYB (aka "scrap your boilerplate")
The modern GHC-based generic mechanism is fast and terse: in fact, its performance is generally comparable in performance to hand-written and TH-derived
FromJSONinstances. To see how to use GHC generics, refer to
The SYB-based generics support lives in
Data.Aeson.Genericand is provided mainly for users of GHC older than 7.2. SYB is far slower (by about 10x) than the more modern generic mechanism. To see how to use SYB generics, refer to
We switched the intermediate representation of JSON objects from
Data.HashMapwhich has improved type conversion performance.
FromJSONfor tuples are between 45% and 70% faster than in 0.3.
This version of aeson makes explicit the decoupling between identifying an element of a JSON document and converting it to Haskell. See the
Data.Aeson.Parserdocumentation for details.
decodefunction performs identification strictly, but defers conversion until needed. This can result in improved performance (e.g. if the results of some conversions are never needed), but at a cost in increased memory consumption.
decode'function performs identification and conversion immediately. This incurs an up-front cost in CPU cycles, but reduces reduce memory consumption.