History¶
Warning
The next major release of jsonpickle (v3.0.0) will drop support for Python 3.6 and earlier (including Python 2.7).
Note
Users on older Python versions should pin requirements to jsonpickle<3.0.0
.
v2.2.0¶
10 May 2022
Classes with a custom
__getitem__()
andappend()
now pickle properly. (#362) (+379)Remove the demjson backend, as demjson hasn’t been maintained for 5 years. (+379)
Added new handler for numpy objects when using unpickleable=False. (#381) (+382)
Added exception handling for class attributes that can’t be accessed. (#301) (+383)
Added a long-requested on_missing attribute to the Unpickler class. This lets you choose behavior for when jsonpickle can’t find a class to deserialize to. (#190) (#193) (+384)
Private members of
__slots__
are no longer skipped when encoding. Any objects encoded with versions prior to 2.2.0 should still decode properly. (#318) (+385)
v2.1.0¶
10 Jan 2022
Python 3.10 is now officially supported. (+376)
Benchmarks were added to aid in optimization efforts. (#350) (+352)
_restore_tags()
was sped up by ~100%. Unpickling items with a lot of tuples and sets will benefit most. Python 2 users and users deserializing pickles from jsonpickle <= 0.9.6 may see a slight performance decrease if using a lot of bytes, ref, and/or repr objects. (+354)
is_iterator()
was sped up by ~20% by removing an unnecessary variable assignment. (+354)
jsonpickle.decode
has a new option,v1_decode
to assist in decoding objects created in jsonpickle version 1. (#364)The
encode()
documentation has been updated to help sklearn users.
demjson
has been removed from the test suite. (+374)
SQLALchemy<1.2
is no longer being tested by jsonpickle. Users of sqlalchemy + jsonpickle can always use 1.2 or 1.3. When jsonpickle v3 is released we will add SQLAlchemy 1.4 to the test suite alongside removal of support for Python 3.5 and earlier.
v2.0.0¶
- 07 Feb 2021
Major release: the serialized JSON format now preserves dictionary identity, which is a subtle change in the serialized format. (#351)
Dictionary identity is now preserved. For example, if the same dictionary appears twice in a list, the reconstituted list will now contain two references to the same dictionary. (#255) (+332)
v1.5.2¶
- 07 Feb 2021
Patch release to avoid the change in behavior from the preservation of dict identity. The next release will be v2.0.0. (#351)
This release does not include the performance improvements from v1.5.1.
Pandas DataFrame objects with multilevel columns are now supported. (#346) (+347)
Numpy 1.20 is now officially supported. (#336)
Python 3.9 is now officially supported. (+348)
Achieved a small speedup for _get_flattener by merging type checks. (+349)
v1.5.1¶
- 30 Jan 2021
The performance of the unpickler was drastically improved by avoiding tag checks for basic Python types. (+340)
decode()
documentation improvements. (+341)Serialization of Pandas DataFrame objects that contain timedelta64[ns] dtypes are now supported. (+330) (#331)
Dictionary identity is now preserved. For example, if the same dictionary appears twice in a list, the reconstituted list will now contain two references to the same dictionary. (#255) (+332)
Unit tests were added to ensure that sklearn.tree.DecisionTreeClassifier objects are properly serialized. (#155) (+344)
The
is_reducible()
utility function used byencode()
is now 4x faster! Objects that provide__getstate__()
,__setstate__()
, and__slots__
benefit most from these improvements. (+343)Improved pickler
flatten()/encode()
performance. (+345)
v1.5.0¶
- 16 Jan 2021
Previous versions of jsonpickle with make_refs=False would emit
null
when encountering an object it had already seen when traversing objects. All instances of the object are now serialized. While this is arguably an improvement in the vast majority of scenarios, it is a change in behavior and is thus considered a minor-level change. (#333) (#334) (#337) (+338)Multiple enums are now serialized correctly with make_refs=False. (#235)
v1.4.2¶
v1.4.1¶
- 20 Apr 2020
Patch release for Python 3.8 importlib_metadata support. (#300)
v1.4¶
- 13 Apr 2020
Python 3.8 support. (#292)
jsonpickle.encode
now supports the standardindent
andseparators
arguments, and passes them through to the active JSON backend library. (#183)We now include a custom handler for array.array objects. (#199)
Dict key order is preserved when pickling dictionaries on Python3. (#193)
Improved serialization of dictionaries with non-string keys. Previously, using an enum that was both the key and a value in a dictionary could end up with incorrect references to other objects. The references are now properly maintained for dicts with object keys that are also referenced in the dict’s values. (#286)
Improved serialization of pandas.Series objects. (#287)
v1.3¶
v1.2¶
- 15 May 2019
Simplified JSON representation for __reduce__ values. (+261)
Improved Pandas support with new handlers for more Pandas data types. (+256)
Prevent stack overflows caused by bugs in user-defined __getstate__ functions which cause infinite recursion. (+260) (#259)
Improved support for objects that contain dicts with Integer keys. Previously, jsonpickle could not restore objects that contained dicts with integer keys and provided getstate only. These objects are now handled robustly. (#247).
Support for encoding binary data in base85 instead of base64 has been added on Python 3. Base85 produces payloads about 10% smaller than base64, albeit at the cost of lower throughput. For performance and backwards compatibility with Python 2 the pickler uses base64 by default, but it can be configured to use
base85
with the newuse_base85
argument. (#251).Dynamic SQLAlchemy tables in SQLAlchemy >= 1.3 are now supported. (#254).
v1.1¶
v1.0¶
- 01 Sep 2018
NOTE jsonpickle no longer supports Python2.6, or Python3 < 3.4. The officially supported Python versions are now 2.7 and 3.4+.
Improved Pandas and Numpy support. (+227)
Improved support for pickling iterators. (+216)
Better support for the stdlib json module when simplejson is not installed. (+217)
jsonpickle will now output python3-style module names when pickling builtins methods or functions. (+223)
jsonpickle will always flatten primitives, even when
max_depth
is reached, which avoids encoding unicode strings into theiru'string'
representation. (+207) (#180) (#198).Nested classes are now supported on Python 3. (+206) (#176).
Better support for older (pre-1.9) versions of numpy (+195).
v0.9.6¶
v0.9.5¶
- 16 Jul 2017
Better support for objects that implement the reduce protocol. (+170) This backward-incompatible change removes the SimpleReduceHandler. Any projects registering that handler for a particular type should instead remove references to the handler and jsonpickle will now handle those types directly.
v0.9.4¶
- 10 Jan 2017
Arbitrary byte streams are now better supported. (#143)
Better support for NumPy data types. The Python3 NumPy support is especially robust.
Fortran-ordered based NumPy arrays are now properly serialized.
v0.9.3¶
- 09 Mar 2016
UUID objects can now be serialized (#130)
Added set_decoder_options method to allow decoder specific options equal to set_encoder_options.
Int keys can be encoded directly by e.g. demjson by passing numeric_keys=True and setting its backend options via jsonpickle.set_encoder_options(‘demjson’, strict=False).
Newer Numpy versions (v1.10+) are now supported.
v0.9.2¶
- 20 Mar 2015
Fixes for serializing objects with custom handlers.
We now properly serialize deque objects constructed with a maxlen parameter.
Test suite fixes
v0.9.1¶
12 Mar 2015
Support datetime objects with FixedOffsets.
v0.9.0¶
- 16 Jan 2015
Support for Pickle Protocol v4.
We now support serializing defaultdict subclasses that use self as their default factory.
We now have a decorator syntax for registering custom handlers, and allow custom handlers to register themselves for all subclasses. (+104)
We now support serializing types with metaclasses and their instances (e.g., Python 3 enum).
We now support serializing bytestrings in both Python 2 and Python 3. In Python 2, the str type is decoded to UTF-8 whenever possible and serialized as a true bytestring elsewise; in Python 3, bytestrings are explicitly encoded/decoded as bytestrings. Unicode strings are always encoded as is in both Python 2 and Python 3.
Added support for serializing numpy arrays, dtypes and scalars (see jsonpickle.ext.numpy module).
v0.8.0¶
06 Sep 2014
We now support serializing objects that contain references to module-level functions. (#77)
Better Pickle Protocol v2 support. (#78)
Support for string
__slots__
and iterable__slots__
. (#67) (#68)encode() now has a warn option that makes jsonpickle emit warnings when encountering objects that cannot be pickled.
A Javascript implementation of jsonpickle is now included in the jsonpickleJS directory.
v0.7.2¶
06 Aug 2014
We now properly serialize classes that inherit from classes that use __slots__ and add additional slots in the derived class.
jsonpickle can now serialize objects that implement __getstate__() but not __setstate__(). The result of __getstate__() is returned as-is when doing a round-trip from Python objects to jsonpickle and back.
Better support for collections.defaultdict with custom factories.
Added support for queue.Queue objects.
v0.7.1¶
06 May 2014
Added support for Python 3.4.
Added support for
posix.stat_result
.
v0.7.0¶
15 Mar 2014
Added
handles
decorator tojsonpickle.handlers.BaseHandler
, enabling simple declaration of a handler for a class.__getstate__() and __setstate__() are now honored when pickling objects that subclass
dict
.jsonpickle can now serialize
collections.Counter
objects.Object references are properly handled when using integer keys.
Object references are now supported when using custom handlers.
Decimal objects are supported in Python 3.
jsonpickle’s “fallthrough-on-error” behavior can now be disabled.
Simpler API for registering custom handlers.
A new “safe-mode” is provided which avoids eval(). Backwards-compatible deserialization of repr-serialized objects is disabled in this mode. e.g. decode(string, safe=True)
v0.6.1¶
25 Aug 2013
Python 3.2 support, and additional fixes for Python 3.
v0.6.0¶
24 Aug 2013
Python 3 support!
time.struct_time
is now serialized using the built-injsonpickle.handlers.SimpleReduceHandler
.
v0.5.0¶
22 Aug 2013
Non-string dictionary keys (e.g. ints, objects) are now supported by passing keys=True to
jsonpickle.encode()
andjsonpickle.decode()
.We now support namedtuple, deque, and defaultdict.
Datetimes with timezones are now fully supported.
Better support for complicated structures e.g. datetime inside dicts.
jsonpickle added support for references and cyclical data structures in 0.4.0. This can be disabled by passing make_refs=False to
jsonpickle.encode()
.
0.4.0¶
21 Jun 2011
Switch build from setuptools to distutils
Consistent dictionary key ordering
Fix areas with improper support for unpicklable=False
Added support for cyclical data structures (#16).
New contributors David K. Hess and Alec Thomas
Warning
To support cyclical data structures (#16), the storage format has been modified. Efforts have been made to ensure backwards-compatibility. jsonpickle 0.4.0 can read data encoded by jsonpickle 0.3.1, but earlier versions of jsonpickle may be unable to read data encoded by jsonpickle 0.4.0.
0.3.1¶
12 Dec 2009
Include tests and docs directories in sdist for distribution packages.
0.3.0¶
11 Dec 2009
Officially migrated to git from subversion. Project home now at http://jsonpickle.github.com/. Thanks to Michael Jone’s sphinx-to-github.
Fortified jsonpickle against common error conditions.
Added support for:
List and set subclasses.
Objects with module references.
Newstyle classes with __slots__.
Objects implementing __setstate__() and __getstate__() (follows the
pickle
protocol).
Improved support for Zope objects via pre-fetch.
Support for user-defined serialization handlers via the jsonpickle.handlers registry.
Removed cjson support per John Millikin’s recommendation.
General improvements to style, including PEP 257 compliance and refactored project layout.
Steps towards Python 2.3 and Python 3 support.
New contributors Dan Buch and Ian Schenck.
Thanks also to Kieran Darcy, Eoghan Murray, and Antonin Hildebrand for their assistance!
0.2.0¶
10 Jan 2009
Support for all major Python JSON backends (including json in Python 2.6, simplejson, cjson, and demjson)
Handle several datetime objects using the repr() of the objects (Thanks to Antonin Hildebrand).
Sphinx documentation
Added support for recursive data structures
Unicode dict-keys support
Support for Google App Engine and Django
Tons of additional testing and bug reports (Antonin Hildebrand, Sorin, Roberto Saccon, Faber Fedor, FirePython, and Joose)
0.1.0¶
22 Aug 2008
Added long as basic primitive (thanks Adam Fisk)
Prefer python-cjson to simplejson, if available
Major API change, use python-cjson’s decode/encode instead of simplejson’s load/loads/dump/dumps
Added benchmark.py to compare simplejson and python-cjson
0.0.5¶
22 Jul 2008
Changed prefix of special fields to conform with CouchDB requirements (Thanks Dean Landolt). Break backwards compatibility.
Moved to Google Code subversion
Fixed unit test imports
0.0.3¶
Convert back to setup.py from pavement.py (issue found by spidaman)
0.0.2¶
Handle feedparser’s FeedParserDict
Converted project to Paver
Restructured directories
Increase test coverage
0.0.1¶
Initial release