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