Thursday, August 21, 2008

jsonpickle 0.1.0 released

Thanks to Adam for finding the bug that missed longs as a primitive type.

In addition to that quick bugfix, jsonpickle has undergone a major API change. At the core of this change is jsonpickle's new preference for python-cjson over simplejson. While python-cjson is not a requirement, if it is installed on the machine, jsonpickle will use python-cjson. python-cjson is faster for jsonpickle (see the benchmarks), but simplejson is still useful on Google's App Engine.

So the API change moves away from the load/loads/dump/dumps functions in the tradition of simplejson towards a simple encode/decode set of functions. If you need to save the output or read a file, you can do that on your own, then send that data into the encode/decode methods. While it may have been smart to deprecate these functions first, I want to get the API correct early on and prevent cruft.

The update example:

>>> import jsonpickle
>>> from jsonpickle.tests.classes import Thing

Create an object.
>>> obj = Thing('A String')
>>> print
A String

Use jsonpickle to transform the object into a JSON string.
>>> pickled = jsonpickle.encode(obj)
>>> print pickled
{"classname__": "Thing", "child": null, "name": "A String", "classmodule__": "jsonpickle.tests.classes"}

Use jsonpickle to recreate a Python object from a JSON string
>>> unpickled = jsonpickle.decode(pickled)
>>> print
A String

Grab the new version.

Thanks also go out to the Joose developers for integrating jsonpickle into their product!

1 comment:

idannasader said...

The ace card is equivalent to a 1 or 11 as desired. King, 카지노사이트 queen and jack cards each equal 10, with other cards at face worth. There are many variants of Tavla in Turkey, where the course of play adjustments drastically. The traditional tavla is recognized as|also called|also referred to as} erkek tavlası meaning boys' or men's tavla. The other variant kız tavlası (meaning ladies' tavla) is a game which relies upon solely on the cube and entails no strategy. This variant would not contain cube at all and the play relies upon more on hand-eye coordination than tactical decision making.