def encode(value, unpicklable=True, make_refs=True, keys=False, max_depth=None, reset=True, backend=None, warn=False, context=None, max_iter=None, use_decimal=False, numeric_keys=False, use_base85=False, fail_safe=None, indent=None, separators=None):
    'Return a JSON formatted representation of value, a Python object.\n\n    :param unpicklable: If set to False then the output will not contain the\n        information necessary to turn the JSON data back into Python objects,\n        but a simpler JSON stream is produced.\n    :param max_depth: If set to a non-negative integer then jsonpickle will\n        not recurse deeper than \'max_depth\' steps into the object.  Anything\n        deeper than \'max_depth\' is represented using a Python repr() of the\n        object.\n    :param make_refs: If set to False jsonpickle\'s referencing support is\n        disabled.  Objects that are id()-identical won\'t be preserved across\n        encode()/decode(), but the resulting JSON stream will be conceptually\n        simpler.  jsonpickle detects cyclical objects and will break the cycle\n        by calling repr() instead of recursing when make_refs is set False.\n    :param keys: If set to True then jsonpickle will encode non-string\n        dictionary keys instead of coercing them into strings via `repr()`.\n        This is typically what you want if you need to support Integer or\n        objects as dictionary keys.\n    :param numeric_keys: Only use this option if the backend supports integer\n        dict keys natively.  This flag tells jsonpickle to leave numeric keys\n        as-is rather than conforming them to json-friendly strings.\n        Using ``keys=True`` is the typical solution for integer keys, so only\n        use this if you have a specific use case where you want to allow the\n        backend to handle serialization of numeric dict keys.\n    :param warn: If set to True then jsonpickle will warn when it\n        returns None for an object which it cannot pickle\n        (e.g. file descriptors).\n    :param max_iter: If set to a non-negative integer then jsonpickle will\n        consume at most `max_iter` items when pickling iterators.\n    :param use_decimal: If set to True jsonpickle will allow Decimal\n        instances to pass-through, with the assumption that the simplejson\n        backend will be used in `use_decimal` mode.  In order to use this mode\n        you will need to configure simplejson::\n\n            jsonpickle.set_encoder_options(\'simplejson\',\n                                           use_decimal=True, sort_keys=True)\n            jsonpickle.set_decoder_options(\'simplejson\',\n                                           use_decimal=True)\n            jsonpickle.set_preferred_backend(\'simplejson\')\n\n        NOTE: A side-effect of the above settings is that float values will be\n        converted to Decimal when converting to json.\n    :param use_base85:\n        If possible, use base85 to encode binary data. Base85 bloats binary data\n        by 1/4 as opposed to base64, which expands it by 1/3. This argument is\n        ignored on Python 2 because it doesn\'t support it.\n    :param fail_safe: If set to a function exceptions are ignored when pickling\n        and if a exception happens the function is called and the return value\n        is used as the value for the object that caused the error\n    :param indent: When `indent` is a non-negative integer, then JSON array\n        elements and object members will be pretty-printed with that indent\n        level.  An indent level of 0 will only insert newlines. ``None`` is\n        the most compact representation.  Since the default item separator is\n        ``(\', \', \': \')``,  the output might include trailing whitespace when\n        ``indent`` is specified.  You can use ``separators=(\',\', \': \')`` to\n        avoid this.  This value is passed directly to the active JSON backend\n        library and not used by jsonpickle directly.\n    :param separators:\n        If ``separators`` is an ``(item_separator, dict_separator)`` tuple\n        then it will be used instead of the default ``(\', \', \': \')``\n        separators.  ``(\',\', \':\')`` is the most compact JSON representation.\n        This value is passed directly to the active JSON backend library and\n        not used by jsonpickle directly.\n\n    >>> encode(\'my string\') == \'"my string"\'\n    True\n    >>> encode(36) == \'36\'\n    True\n    >>> encode({\'foo\': True}) == \'{"foo": true}\'\n    True\n    >>> encode({\'foo\': [1, 2, [3, 4]]}, max_depth=1)\n    \'{"foo": "[1, 2, [3, 4]]"}\'\n\n    '
    backend = (backend or json)
    context = (context or Pickler(unpicklable=unpicklable, make_refs=make_refs, keys=keys, backend=backend, max_depth=max_depth, warn=warn, max_iter=max_iter, numeric_keys=numeric_keys, use_decimal=use_decimal, use_base85=use_base85, fail_safe=fail_safe))
    return backend.encode(context.flatten(value, reset=reset), indent=indent, separators=separators)
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()`.
    This is typically what you want if you need to support Integer or
    objects as dictionary keys.
:param numeric_keys: Only use this option if the backend supports integer
    dict keys natively.  This flag tells jsonpickle to leave numeric keys
    as-is rather than conforming them to json-friendly strings.
    Using ``keys=True`` is the typical solution for integer keys, so only
    use this if you have a specific use case where you want to allow the
    backend to handle serialization of numeric dict keys.
: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.
:param use_decimal: If set to True jsonpickle will allow Decimal
    instances to pass-through, with the assumption that the simplejson
    backend will be used in `use_decimal` mode.  In order to use this mode
    you will need to configure simplejson::

        jsonpickle.set_encoder_options('simplejson',
                                       use_decimal=True, sort_keys=True)
        jsonpickle.set_decoder_options('simplejson',
                                       use_decimal=True)
        jsonpickle.set_preferred_backend('simplejson')

    NOTE: A side-effect of the above settings is that float values will be
    converted to Decimal when converting to json.
:param use_base85:
    If possible, use base85 to encode binary data. Base85 bloats binary data
    by 1/4 as opposed to base64, which expands it by 1/3. This argument is
    ignored on Python 2 because it doesn't support it.
:param fail_safe: If set to a function exceptions are ignored when pickling
    and if a exception happens the function is called and the return value
    is used as the value for the object that caused the error
:param indent: When `indent` is a non-negative integer, then JSON array
    elements and object members will be pretty-printed with that indent
    level.  An indent level of 0 will only insert newlines. ``None`` is
    the most compact representation.  Since the default item separator is
    ``(', ', ': ')``,  the output might include trailing whitespace when
    ``indent`` is specified.  You can use ``separators=(',', ': ')`` to
    avoid this.  This value is passed directly to the active JSON backend
    library and not used by jsonpickle directly.
:param separators:
    If ``separators`` is an ``(item_separator, dict_separator)`` tuple
    then it will be used instead of the default ``(', ', ': ')``
    separators.  ``(',', ':')`` is the most compact JSON representation.
    This value is passed directly to the active JSON backend library and
    not used by jsonpickle directly.

>>> encode('my string') == '"my string"'
True
>>> encode(36) == '36'
True
>>> encode({'foo': True}) == '{"foo": true}'
True
>>> encode({'foo': [1, 2, [3, 4]]}, max_depth=1)
'{"foo": "[1, 2, [3, 4]]"}'
def encode(value, unpicklable=True, make_refs=True, keys=False, max_depth=None, reset=True, backend=None, warn=False, context=None, max_iter=None, use_decimal=False, numeric_keys=False, use_base85=False, fail_safe=None, indent=None, separators=None):
    'Return a JSON formatted representation of value, a Python object.\n\n    :param unpicklable: If set to False then the output will not contain the\n        information necessary to turn the JSON data back into Python objects,\n        but a simpler JSON stream is produced.\n    :param max_depth: If set to a non-negative integer then jsonpickle will\n        not recurse deeper than \'max_depth\' steps into the object.  Anything\n        deeper than \'max_depth\' is represented using a Python repr() of the\n        object.\n    :param make_refs: If set to False jsonpickle\'s referencing support is\n        disabled.  Objects that are id()-identical won\'t be preserved across\n        encode()/decode(), but the resulting JSON stream will be conceptually\n        simpler.  jsonpickle detects cyclical objects and will break the cycle\n        by calling repr() instead of recursing when make_refs is set False.\n    :param keys: If set to True then jsonpickle will encode non-string\n        dictionary keys instead of coercing them into strings via `repr()`.\n        This is typically what you want if you need to support Integer or\n        objects as dictionary keys.\n    :param numeric_keys: Only use this option if the backend supports integer\n        dict keys natively.  This flag tells jsonpickle to leave numeric keys\n        as-is rather than conforming them to json-friendly strings.\n        Using ``keys=True`` is the typical solution for integer keys, so only\n        use this if you have a specific use case where you want to allow the\n        backend to handle serialization of numeric dict keys.\n    :param warn: If set to True then jsonpickle will warn when it\n        returns None for an object which it cannot pickle\n        (e.g. file descriptors).\n    :param max_iter: If set to a non-negative integer then jsonpickle will\n        consume at most `max_iter` items when pickling iterators.\n    :param use_decimal: If set to True jsonpickle will allow Decimal\n        instances to pass-through, with the assumption that the simplejson\n        backend will be used in `use_decimal` mode.  In order to use this mode\n        you will need to configure simplejson::\n\n            jsonpickle.set_encoder_options(\'simplejson\',\n                                           use_decimal=True, sort_keys=True)\n            jsonpickle.set_decoder_options(\'simplejson\',\n                                           use_decimal=True)\n            jsonpickle.set_preferred_backend(\'simplejson\')\n\n        NOTE: A side-effect of the above settings is that float values will be\n        converted to Decimal when converting to json.\n    :param use_base85:\n        If possible, use base85 to encode binary data. Base85 bloats binary data\n        by 1/4 as opposed to base64, which expands it by 1/3. This argument is\n        ignored on Python 2 because it doesn\'t support it.\n    :param fail_safe: If set to a function exceptions are ignored when pickling\n        and if a exception happens the function is called and the return value\n        is used as the value for the object that caused the error\n    :param indent: When `indent` is a non-negative integer, then JSON array\n        elements and object members will be pretty-printed with that indent\n        level.  An indent level of 0 will only insert newlines. ``None`` is\n        the most compact representation.  Since the default item separator is\n        ``(\', \', \': \')``,  the output might include trailing whitespace when\n        ``indent`` is specified.  You can use ``separators=(\',\', \': \')`` to\n        avoid this.  This value is passed directly to the active JSON backend\n        library and not used by jsonpickle directly.\n    :param separators:\n        If ``separators`` is an ``(item_separator, dict_separator)`` tuple\n        then it will be used instead of the default ``(\', \', \': \')``\n        separators.  ``(\',\', \':\')`` is the most compact JSON representation.\n        This value is passed directly to the active JSON backend library and\n        not used by jsonpickle directly.\n\n    >>> encode(\'my string\') == \'"my string"\'\n    True\n    >>> encode(36) == \'36\'\n    True\n    >>> encode({\'foo\': True}) == \'{"foo": true}\'\n    True\n    >>> encode({\'foo\': [1, 2, [3, 4]]}, max_depth=1)\n    \'{"foo": "[1, 2, [3, 4]]"}\'\n\n    '
    backend = (backend or json)
    context = (context or Pickler(unpicklable=unpicklable, make_refs=make_refs, keys=keys, backend=backend, max_depth=max_depth, warn=warn, max_iter=max_iter, numeric_keys=numeric_keys, use_decimal=use_decimal, use_base85=use_base85, fail_safe=fail_safe))
    return backend.encode(context.flatten(value, reset=reset), indent=indent, separators=separators)