1For the latest version of this document, please see [https://github.com/bos/aeson/blob/master/changelog.md](https://github.com/bos/aeson/blob/master/changelog.md).
5This release should be close to backwards compatible with aeson 0.9.
7If you are upgrading from aeson 0.10 it might be easier to go back in
8history to the point you were still using 0.9.
12* Revert `.:?` to behave like it did in 0.9. If you want the 0.10
13 behavior use `.:!` instead.
15* Revert JSON format of `Either` to 0.9, `Left` and `Right` are now
16 serialized with an initial uppercase letter. If you want the names
17 in lowercase you can add a newtype with an instance.
19* All `ToJSON` and `FromJSON` instances except for `[a]` are no longer
20 `OVERLAPPABLE`. Mark your instance as `OVERLAPPING` if it overlaps
21 any of the other aeson instances.
23* All `ToJSON` and `FromJSON` instances except for `[Char]` are no
24 longer incoherent, this means you may need to replace your
25 incoherent instances with a newtyped instance.
29* Introduce `.:!` that behaves like `.:?` did in 0.10.
31* Allow `HH:MM` format for `ZonedTime` and `UTCTime`.
32 This is one of the formats allowed by
33 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Times).
35* Added `ToJSON` and `FromJSON` instances for the
36 `Version`, `Ordering`, and `Natural` types.
40* JSONPath identifiers are now escaped if they contain invalid characters.
42* Fixed JSONPath messages for Seq to include indices.
44* Fixed JSONPath messages for Either to include `left`/`right`.
46* Fix missing quotes surrounding time encodings.
48* Fix #293: Type error in TH when using `omitNothingFields = True`.
52* Various updates to support GHC 8.
57## Performance improvements
59* Direct encoding via the new `toEncoding` method is over 2x faster
60 than `toJSON`. (You must write or code-gen a `toEncoding`
61 implementation to unlock this speedup. See below for details.)
63* Improved string decoding gives a 12% speed win in parsing
64 string-heavy JSON payloads (very common).
66* Encoding and decoding of time-related types are 10x faster (!!) as a
67 result of bypassing `Data.Time.Format` and the arbitrary-precision
70* When using `toEncoding`, `[Char]` can be encoded without a conversion to
71 `Text`. This is fast and efficient.
73* Parsing into an `Object` is now 5% faster and more
76## SUBTLE API CHANGES, READ CAREFULLY
78With the exception of long-deprecated code, the API changes below
79**should be upwards compatible** from older versions of `aeson`. If you run
80into upgrade problems, please file an issue with details.
82* The `ToJSON` class has a new method, `toEncoding`, that allows
83 direct encoding from a Haskell value to a lazy bytestring without
84 construction of an intermediate `Value`.
86 The performance benefits of direct encoding are significant: more
87 than 2x faster than before, with less than 1/3 the memory usage.
89 To preserve API compatibility across upgrades from older versions of
90 this library, the default implementation of `toEncoding` uses
91 `toJSON`. You will *not* see any performance improvement unless you
92 write an implementation of `toEncoding`, which can be very simple:
95 instance ToJSON Coord where
96 toEncoding = genericToEncoding defaultOptions
99 (Behind the scenes, the `encode` function uses `toEncoding` now, so
100 if you implement `toEncoding` for your types, you should see a
101 speedup immediately.)
103 If you use Template Haskell or GHC Generics to auto-generate your
104 `ToJSON` instances, you'll benefit from fast toEncoding
105 implementations for free!
107* When converting from a `Value` to a target Haskell type, `FromJSON`
108 instances now provide much better error messages, including a
109 complete JSON path from the root of the object to the offending
110 element. This greatly eases debugging.
112* It is now possible to use Template Haskell to generate `FromJSON`
113 and `ToJSON` instances for types in data families.
115* If you use Template Haskell or generics, and used to use the
116 `camelTo` function to rename fields, the new `camelTo2` function is
117 smarter. For example, `camelTo` will rename `CamelAPICase` to
118 `camelapi_case` (ugh!), while `camelTo2` will map it to
119 `camel_api_case` (yay!).
121* New `ToJSON` and `FromJSON` instances for the following time-related
122 types: `Day`, `LocalTime`.
124* `FromJSON` `UTCTime` parser accepts the same values as for `ZonedTime`,
125 but converts any time zone offset into a UTC time.
127* The `Result` type is now an instance of `Foldable` and `Traversable`.
129* The `Data.Aeson.Generic` module has been removed. It was deprecated in
132* GHC 7.2 and older are no longer supported.
134* The instance of `Monad` for the `Result` type lacked an implementation
135 of `fail` (oops). This has been corrected.
137* Semantics of `(.:?)` operator are changed. It's doesn't anymore accept
138 present `Null` value.
140* Added `(Foldable t, ToJSON a) => ToJSON (t a)` overlappable instance.
141 You might see `No instance for (Foldable YourPolymorphicType) arising from a
142 use of ‘.=’` -errors due this change.
146* A stray export of `encodeToBuilder` got away!
150* The `json` and `json'` parsers are now synonyms for `value` and
151 `value'`, in conformance with the looser semantics of RFC 7159.
153* Renamed `encodeToByteStringBuilder` to the more compact
158* The dependency on the `unordered-containers` package was too lax,
159 and has been corrected.
163* Encoding a `Scientific` value with a huge exponent is now handled
164 efficiently. (This would previously allocate a huge
165 arbitrary-precision integer, potentially leading to a denial of
168* Handling of strings that contain backslash escape sequences is
169 greatly improved. For a pathological string containing almost a
170 megabyte of consecutive backslashes, the new implementation is 27x
171 faster and uses 42x less memory.
173* The `ToJSON` instance for `UTCTime` is rendered with higher
174 (picosecond) resolution.
176* The `value` parser now correctly handles leading whitespace.
178* New instances of `ToJSON` and `FromJSON` for `Data.Sequence` and
179 `Data.Functor.Identity`. The `Value` type now has a `Read` instance.
181* `ZonedTime` parser ordering now favours the standard `JSON` format,
182 increasing efficiency in the common case.
184* Encoding to a `Text.Builder` now escapes `'<'` and `'>'` characters,
189* Fix `ToJSON` instance for 15-tuples (see #223).
197* Add `ToJSON` and `FromJSON` instances for tuples of up to 15
202* Major compiler and library compatibility changes: we have dropped
203 support for GHC older than 7.4, `text` older than 1.1, and
204 `bytestring` older than 0.10.4.0. Supporting the older versions had
205 become increasingly difficult, to the point where it was no longer
210* The performance of encoding to and decoding of bytestrings have both
211 improved by up to 2x, while also using less memory.
213* New dependency: the `scientific` package lets us parse floating point
214 numbers more quickly and accurately.
216* `eitherDecode`, `decodeStrictWith`: fixed bugs.
218* Added `FromJSON` and `ToJSON` instances for `Tree` and `Scientific`.
220* Fixed the `ToJSON` instances for `UTCTime` and `ZonedTime`.
224* Much improved documentation.
226* Angle brackets are now escaped in JSON strings, to help avoid XSS
229* Fixed up handling of nullary constructors when using generic
232* Added `ToJSON`/`FromJSON` instances for:
235 * ISO-8601 dates: `UTCTime`, `ZonedTime`, and `TimeZone`
237* Added accessor functions for inspecting `Value`s.
239* Added `eitherDecode` function that returns an error message if
244* This release introduces a slightly obscure, but
245 backwards-incompatible, change.
247 In the generic APIs of versions 0.4 and 0.5, fields whose names
248 began with a `"_"` character would have this character removed. This
249 no longer occurs, as it was both buggy and surprising
250 (https://github.com/bos/aeson/issues/53).
252* Fixed a bug in generic decoding of nullary constructors
253 (https://github.com/bos/aeson/issues/62).
257* When used with the UTF-8 encoding performance improvements
258 introduced in version 0.11.1.12 of the `text` package, this release
259 improves `aeson`'s JSON encoding performance by 33% relative to
262 As part of achieving this improvement, an API change was necessary.
263 The `fromValue` function in the `Data.Aeson.Encode` module now uses
264 the `text` package's `Builder` type instead of the `blaze-builder`
265 package's `Builder` type.
269* The new `decode` function complements the longstanding `encode`
270 function, and makes the API simpler.
272* New examples make it easier to learn to use the package
273 (https://github.com/bos/aeson/tree/master/examples).
277 `aeson`'s support for data-type generic programming makes it
278 possible to use JSON encodings of most data types without writing
279 any boilerplate instances.
281 Thanks to Bas Van Dijk, `aeson` now supports the two major schemes
282 for doing datatype-generic programming:
284 * the modern mechanism, built into GHC itself
285 (http://www.haskell.org/ghc/docs/latest/html/users_guide/generic-programming.html)
287 * the older mechanism, based on SYB (aka "scrap your
290 The modern GHC-based generic mechanism is fast and terse: in fact,
291 its performance is generally comparable in performance to
292 hand-written and TH-derived `ToJSON` and `FromJSON` instances. To
293 see how to use GHC generics, refer to `examples/Generic.hs`.
295 The SYB-based generics support lives in `Data.Aeson.Generic` and is
296 provided mainly for users of GHC older than 7.2. SYB is far slower
297 (by about 10x) than the more modern generic mechanism. To see how
298 to use SYB generics, refer to `examples/GenericSYB.hs`.
300* We switched the intermediate representation of JSON objects from
301 `Data.Map` to `Data.HashMap` which has improved type conversion
304* Instances of `ToJSON` and `FromJSON` for tuples are between 45% and 70%
309 This version of aeson makes explicit the decoupling between
310 *identifying* an element of a JSON document and *converting* it to
311 Haskell. See the `Data.Aeson.Parser` documentation for details.
313 The normal `aeson` `decode` function performs identification
314 strictly, but defers conversion until needed. This can result in
315 improved performance (e.g. if the results of some conversions are
316 never needed), but at a cost in increased memory consumption.
318 The new `decode'` function performs identification and conversion
319 immediately. This incurs an up-front cost in CPU cycles, but
320 reduces reduce memory consumption.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list