on 0.11.2.0 help sign in
typeable/aeson/changelog.md
360 lines 12 kB history raw
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).
3### 0.11.2.0
5* Enable `PolyKinds` to generalize `Proxy`, `Tagged`, and `Const` instances.
6* Add `unsafeToEncoding` in `Data.Aeson.Types`, use with care!
8#### 0.11.1.4
10* Fix build with `base >= 4.8` and `unordered-containers < 0.2.6`.
12#### 0.11.1.3
14* Fix build on TH-less GHCs
16#### 0.11.1.2
18* Fix build with `base < 4.8` and `unordered-containers < 0.2.6`.
19* Add missing field in docs for `defaultOptions`.
21#### 0.11.1.1
23* Fixes a bug where the hashes of equal values could differ.
25### 0.11.1.0
27The only changes are added instances.
29These are new:
30* `ToJSON a => ToJSON (NonEmpty a)`
31* `FromJSON a => FromJSON (NonEmpty a)`
32* `ToJSON (Proxy a)`
33* `FromJSON (Proxy a)`
34* `ToJSON b => ToJSON (Tagged a b)`
35* `FromJSON b => FromJSON (Tagged a b)`
36* `ToJSON a => ToJSON (Const a b)`
37* `FromJSON a => FromJSON (Const a b)`
39These are now available for older GHCs:
40* `ToJSON Natural`
41* `FromJSON Natural`
43# 0.11.0.0
45This release should be close to backwards compatible with aeson 0.9.
47If you are upgrading from aeson 0.10 it might be easier to go back in
48history to the point you were still using 0.9.
50**Breaking changes**:
52* Revert `.:?` to behave like it did in 0.9. If you want the 0.10
53 behavior use `.:!` instead.
55* Revert JSON format of `Either` to 0.9, `Left` and `Right` are now
56 serialized with an initial uppercase letter. If you want the names
57 in lowercase you can add a newtype with an instance.
59* All `ToJSON` and `FromJSON` instances except for `[a]` are no longer
60 `OVERLAPPABLE`. Mark your instance as `OVERLAPPING` if it overlaps
61 any of the other aeson instances.
63* All `ToJSON` and `FromJSON` instances except for `[Char]` are no
64 longer incoherent, this means you may need to replace your
65 incoherent instances with a newtyped instance.
67**Additions**:
69* Introduce `.:!` that behaves like `.:?` did in 0.10.
71* Allow `HH:MM` format for `ZonedTime` and `UTCTime`.
72 This is one of the formats allowed by
73 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Times).
75* Added `ToJSON` and `FromJSON` instances for the
76 `Version`, `Ordering`, and `Natural` types.
78**Bug fixes**:
80* JSONPath identifiers are now escaped if they contain invalid characters.
82* Fixed JSONPath messages for Seq to include indices.
84* Fixed JSONPath messages for Either to include `left`/`right`.
86* Fix missing quotes surrounding time encodings.
88* Fix #293: Type error in TH when using `omitNothingFields = True`.
90**Compatibility**:
92* Various updates to support GHC 8.
95# 0.10.0.0
97## Performance improvements
99* Direct encoding via the new `toEncoding` method is over 2x faster
100 than `toJSON`. (You must write or code-gen a `toEncoding`
101 implementation to unlock this speedup. See below for details.)
103* Improved string decoding gives a 12% speed win in parsing
104 string-heavy JSON payloads (very common).
106* Encoding and decoding of time-related types are 10x faster (!!) as a
107 result of bypassing `Data.Time.Format` and the arbitrary-precision
108 `Integer` type.
110* When using `toEncoding`, `[Char]` can be encoded without a conversion to
111 `Text`. This is fast and efficient.
113* Parsing into an `Object` is now 5% faster and more
114 allocation-efficient.
116## SUBTLE API CHANGES, READ CAREFULLY
118With the exception of long-deprecated code, the API changes below
119**should be upwards compatible** from older versions of `aeson`. If you run
120into upgrade problems, please file an issue with details.
122* The `ToJSON` class has a new method, `toEncoding`, that allows
123 direct encoding from a Haskell value to a lazy bytestring without
124 construction of an intermediate `Value`.
126 The performance benefits of direct encoding are significant: more
127 than 2x faster than before, with less than 1/3 the memory usage.
129 To preserve API compatibility across upgrades from older versions of
130 this library, the default implementation of `toEncoding` uses
131 `toJSON`. You will *not* see any performance improvement unless you
132 write an implementation of `toEncoding`, which can be very simple:
134 ```haskell
135 instance ToJSON Coord where
136 toEncoding = genericToEncoding defaultOptions
137 ```
139 (Behind the scenes, the `encode` function uses `toEncoding` now, so
140 if you implement `toEncoding` for your types, you should see a
141 speedup immediately.)
143 If you use Template Haskell or GHC Generics to auto-generate your
144 `ToJSON` instances, you'll benefit from fast toEncoding
145 implementations for free!
147* When converting from a `Value` to a target Haskell type, `FromJSON`
148 instances now provide much better error messages, including a
149 complete JSON path from the root of the object to the offending
150 element. This greatly eases debugging.
152* It is now possible to use Template Haskell to generate `FromJSON`
153 and `ToJSON` instances for types in data families.
155* If you use Template Haskell or generics, and used to use the
156 `camelTo` function to rename fields, the new `camelTo2` function is
157 smarter. For example, `camelTo` will rename `CamelAPICase` to
158 `camelapi_case` (ugh!), while `camelTo2` will map it to
159 `camel_api_case` (yay!).
161* New `ToJSON` and `FromJSON` instances for the following time-related
162 types: `Day`, `LocalTime`.
164* `FromJSON` `UTCTime` parser accepts the same values as for `ZonedTime`,
165 but converts any time zone offset into a UTC time.
167* The `Result` type is now an instance of `Foldable` and `Traversable`.
169* The `Data.Aeson.Generic` module has been removed. It was deprecated in
170 late 2013.
172* GHC 7.2 and older are no longer supported.
174* The instance of `Monad` for the `Result` type lacked an implementation
175 of `fail` (oops). This has been corrected.
177* Semantics of `(.:?)` operator are changed. It's doesn't anymore accept
178 present `Null` value.
180* Added `(Foldable t, ToJSON a) => ToJSON (t a)` overlappable instance.
181 You might see `No instance for (Foldable YourPolymorphicType) arising from a
182 use of ‘.=’` -errors due this change.
184# 0.9.0.1
186* A stray export of `encodeToBuilder` got away!
188# 0.9.0.0
190* The `json` and `json'` parsers are now synonyms for `value` and
191 `value'`, in conformance with the looser semantics of RFC 7159.
193* Renamed `encodeToByteStringBuilder` to the more compact
194 `encodeToBuilder`.
196# 0.8.1.1
198* The dependency on the `unordered-containers` package was too lax,
199 and has been corrected.
201# 0.8.1.0
203* Encoding a `Scientific` value with a huge exponent is now handled
204 efficiently. (This would previously allocate a huge
205 arbitrary-precision integer, potentially leading to a denial of
206 service.)
208* Handling of strings that contain backslash escape sequences is
209 greatly improved. For a pathological string containing almost a
210 megabyte of consecutive backslashes, the new implementation is 27x
211 faster and uses 42x less memory.
213* The `ToJSON` instance for `UTCTime` is rendered with higher
214 (picosecond) resolution.
216* The `value` parser now correctly handles leading whitespace.
218* New instances of `ToJSON` and `FromJSON` for `Data.Sequence` and
219 `Data.Functor.Identity`. The `Value` type now has a `Read` instance.
221* `ZonedTime` parser ordering now favours the standard `JSON` format,
222 increasing efficiency in the common case.
224* Encoding to a `Text.Builder` now escapes `'<'` and `'>'` characters,
225 to reduce XSS risk.
227# 0.8.0.2
229* Fix `ToJSON` instance for 15-tuples (see #223).
231# 0.8.0.1
233* Support `time-1.5`.
235# 0.8.0.0
237* Add `ToJSON` and `FromJSON` instances for tuples of up to 15
238 elements.
240# 0.7.1.0
242* Major compiler and library compatibility changes: we have dropped
243 support for GHC older than 7.4, `text` older than 1.1, and
244 `bytestring` older than 0.10.4.0. Supporting the older versions had
245 become increasingly difficult, to the point where it was no longer
246 worth it.
248# 0.7.0.0
250* The performance of encoding to and decoding of bytestrings have both
251 improved by up to 2x, while also using less memory.
253* New dependency: the `scientific` package lets us parse floating point
254 numbers more quickly and accurately.
256* `eitherDecode`, `decodeStrictWith`: fixed bugs.
258* Added `FromJSON` and `ToJSON` instances for `Tree` and `Scientific`.
260* Fixed the `ToJSON` instances for `UTCTime` and `ZonedTime`.
262# 0.6 series
264* Much improved documentation.
266* Angle brackets are now escaped in JSON strings, to help avoid XSS
267 attacks.
269* Fixed up handling of nullary constructors when using generic
270 encoding.
272* Added `ToJSON`/`FromJSON` instances for:
274 * The `Fixed` class
275 * ISO-8601 dates: `UTCTime`, `ZonedTime`, and `TimeZone`
277* Added accessor functions for inspecting `Value`s.
279* Added `eitherDecode` function that returns an error message if
280 decoding fails.
282# 0.5 to 0.6
284* This release introduces a slightly obscure, but
285 backwards-incompatible, change.
287 In the generic APIs of versions 0.4 and 0.5, fields whose names
288 began with a `"_"` character would have this character removed. This
289 no longer occurs, as it was both buggy and surprising
290 (https://github.com/bos/aeson/issues/53).
292* Fixed a bug in generic decoding of nullary constructors
293 (https://github.com/bos/aeson/issues/62).
295# 0.4 to 0.5
297* When used with the UTF-8 encoding performance improvements
298 introduced in version 0.11.1.12 of the `text` package, this release
299 improves `aeson`'s JSON encoding performance by 33% relative to
300 `aeson` 0.4.
302 As part of achieving this improvement, an API change was necessary.
303 The `fromValue` function in the `Data.Aeson.Encode` module now uses
304 the `text` package's `Builder` type instead of the `blaze-builder`
305 package's `Builder` type.
307# 0.3 to 0.4
309* The new `decode` function complements the longstanding `encode`
310 function, and makes the API simpler.
312* New examples make it easier to learn to use the package
313 (https://github.com/bos/aeson/tree/master/examples).
315* Generics support
317 `aeson`'s support for data-type generic programming makes it
318 possible to use JSON encodings of most data types without writing
319 any boilerplate instances.
321 Thanks to Bas Van Dijk, `aeson` now supports the two major schemes
322 for doing datatype-generic programming:
324 * the modern mechanism, built into GHC itself
325 (http://www.haskell.org/ghc/docs/latest/html/users_guide/generic-programming.html)
327 * the older mechanism, based on SYB (aka "scrap your
328 boilerplate")
330 The modern GHC-based generic mechanism is fast and terse: in fact,
331 its performance is generally comparable in performance to
332 hand-written and TH-derived `ToJSON` and `FromJSON` instances. To
333 see how to use GHC generics, refer to `examples/Generic.hs`.
335 The SYB-based generics support lives in `Data.Aeson.Generic` and is
336 provided mainly for users of GHC older than 7.2. SYB is far slower
337 (by about 10x) than the more modern generic mechanism. To see how
338 to use SYB generics, refer to `examples/GenericSYB.hs`.
340* We switched the intermediate representation of JSON objects from
341 `Data.Map` to `Data.HashMap` which has improved type conversion
342 performance.
344* Instances of `ToJSON` and `FromJSON` for tuples are between 45% and 70%
345 faster than in 0.3.
347* Evaluation control
349 This version of aeson makes explicit the decoupling between
350 *identifying* an element of a JSON document and *converting* it to
351 Haskell. See the `Data.Aeson.Parser` documentation for details.
353 The normal `aeson` `decode` function performs identification
354 strictly, but defers conversion until needed. This can result in
355 improved performance (e.g. if the results of some conversions are
356 never needed), but at a cost in increased memory consumption.
358 The new `decode'` function performs identification and conversion
359 immediately. This incurs an up-front cost in CPU cycles, but
360 reduces reduce memory consumption.