Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Expr Call NameLoad Str Assign NameStore TupleLoad Str Str Assign NameStore NameLoad Assign NameStore Call NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore NameLoad Return Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore NameLoad Return Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword NameLoad decorator_list Assign NameStore NameLoad Assign NameStore NameLoad
N/A N/A Python library for serializing any arbitrary object graph into JSON.

jsonpickle can take almost any Python object and turn the object into JSON.
Additionally, it can reconstitute the object back into Python.

The object must be accessible globally via a module and must
inherit from object (AKA new-style classes).

Create an object::

    class Thing(object):
        def __init__(self, name):
            self.name = name

    obj = Thing('Awesome')

Use jsonpickle to transform the object into a JSON string::

    import jsonpickle
    frozen = jsonpickle.encode(obj)

Use jsonpickle to recreate a Python object from a JSON string::

    thawed = jsonpickle.decode(frozen)

.. warning::

    Loading a JSON string from an untrusted source represents a potential
    security vulnerability.  jsonpickle makes no attempt to sanitize the input.

The new object has the same type and data, but essentially is now a copy of
the original.

.. code-block:: python

    assert obj.name == thawed.name

If you will never need to load (regenerate the Python class from JSON), you can
pass in the keyword unpicklable=False to prevent extra information from being
added to JSON::

    oneway = jsonpickle.encode(obj, unpicklable=False)
    result = jsonpickle.decode(oneway)
    assert obj.name == result['name'] == 'Awesome'

 jsonpickle pickler jsonpickle unpickler jsonpickle.backend JSONBackend jsonpickle.version VERSION N/A N/A __import__ jsonpickle.handlers N/A __all__ N/A encode decode N/A __version__ VERSION N/A json N/A JSONBackend N/A set_preferred_backend N/A json set_preferred_backend N/A set_decoder_options N/A json set_decoder_options N/A set_encoder_options N/A json set_encoder_options N/A load_backend N/A json load_backend N/A remove_backend N/A json remove_backend N/A enable_fallthrough N/A json enable_fallthrough encode N/A N/A value unpicklable make_refs keys max_depth backend warn max_iter numeric_keys N/A True True False None None False None False N/A N/A Return a JSON formatted representation of value, a Python object.

    :param unpicklable: If set to False then the output will not contain the
        information necessary to turn the JSON data back into Python objects,
        but a simpler JSON stream is produced.
    :param max_depth: If set to a non-negative integer then jsonpickle will
        not recurse deeper than 'max_depth' steps into the object.  Anything
        deeper than 'max_depth' is represented using a Python repr() of the
        object.
    :param make_refs: If set to False jsonpickle's referencing support is
        disabled.  Objects that are id()-identical won't be preserved across
        encode()/decode(), but the resulting JSON stream will be conceptually
        simpler.  jsonpickle detects cyclical objects and will break the cycle
        by calling repr() instead of recursing when make_refs is set False.
    :param keys: If set to True then jsonpickle will encode non-string
        dictionary keys instead of coercing them into strings via `repr()`.
    :param warn: If set to True then jsonpickle will warn when it
        returns None for an object which it cannot pickle
        (e.g. file descriptors).
    :param max_iter: If set to a non-negative integer then jsonpickle will
        consume at most `max_iter` items when pickling iterators.

    >>> encode('my string')
    '"my string"'
    >>> encode(36)
    '36'

    >>> encode({'foo': True})
    '{"foo": true}'

    >>> encode({'foo': True}, max_depth=0)
    '"{\'foo\': True}"'

    >>> encode({'foo': True}, max_depth=1)
    '{"foo": "True"}'


     N/A N/A backend None N/A N/A backend json N/A N/A N/A pickler encode value backend backend unpicklable unpicklable make_refs make_refs keys keys max_depth max_depth warn warn max_iter max_iter numeric_keys numeric_keys N/A decode N/A N/A string backend keys N/A None False N/A N/A Convert a JSON string into a Python object.

    The keyword argument 'keys' defaults to False.
    If set to True then jsonpickle will decode non-string dictionary keys
    into python objects via the jsonpickle protocol.

    >>> str(decode('"my string"'))
    'my string'
    >>> decode('36')
    36
     N/A N/A backend None N/A N/A backend json N/A N/A N/A unpickler decode string backend backend keys keys N/A N/A dumps encode N/A loads decode