{
    "mode": "pydoc",
    "parameter": "simplejson",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/simplejson/json",
    "generated": "2026-06-02T15:02:26Z",
    "sections": {
        "NAME": {
            "content": "simplejson\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained\nversion of the :mod:`json` library contained in Python 2.6, but maintains\ncompatibility back to Python 2.5 and (currently) has significant performance\nadvantages, even without using the optional C extension for speedups.\n\nEncoding basic Python object hierarchies::\n\n>>> import simplejson as json\n>>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])\n'[\"foo\", {\"bar\": [\"baz\", null, 1.0, 2]}]'\n>>> print(json.dumps(\"\\\"foo\\bar\"))\n\"\\\"foo\\bar\"\n>>> print(json.dumps(u'\\u1234'))\n\"\\u1234\"\n>>> print(json.dumps('\\\\'))\n\"\\\\\"\n>>> print(json.dumps({\"c\": 0, \"b\": 0, \"a\": 0}, sortkeys=True))\n{\"a\": 0, \"b\": 0, \"c\": 0}\n>>> from simplejson.compat import StringIO\n>>> io = StringIO()\n>>> json.dump(['streaming API'], io)\n>>> io.getvalue()\n'[\"streaming API\"]'\n\nCompact encoding::\n\n>>> import simplejson as json\n>>> obj = [1,2,3,{'4': 5, '6': 7}]\n>>> json.dumps(obj, separators=(',',':'), sortkeys=True)\n'[1,2,3,{\"4\":5,\"6\":7}]'\n\nPretty printing::\n\n>>> import simplejson as json\n>>> print(json.dumps({'4': 5, '6': 7}, sortkeys=True, indent='    '))\n{\n\"4\": 5,\n\"6\": 7\n}\n\nDecoding JSON::\n\n>>> import simplejson as json\n>>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]\n>>> json.loads('[\"foo\", {\"bar\":[\"baz\", null, 1.0, 2]}]') == obj\nTrue\n>>> json.loads('\"\\\\\"foo\\\\bar\"') == u'\"foo\\x08ar'\nTrue\n>>> from simplejson.compat import StringIO\n>>> io = StringIO('[\"streaming API\"]')\n>>> json.load(io)[0] == 'streaming API'\nTrue\n\nSpecializing JSON object decoding::\n\n>>> import simplejson as json\n>>> def ascomplex(dct):\n...     if 'complex' in dct:\n...         return complex(dct['real'], dct['imag'])\n...     return dct\n...\n>>> json.loads('{\"complex\": true, \"real\": 1, \"imag\": 2}',\n...     objecthook=ascomplex)\n(1+2j)\n>>> from decimal import Decimal\n>>> json.loads('1.1', parsefloat=Decimal) == Decimal('1.1')\nTrue\n\nSpecializing JSON object encoding::\n\n>>> import simplejson as json\n>>> def encodecomplex(obj):\n...     if isinstance(obj, complex):\n...         return [obj.real, obj.imag]\n...     raise TypeError('Object of type %s is not JSON serializable' %\n...                     obj.class.name)\n...\n>>> json.dumps(2 + 1j, default=encodecomplex)\n'[2.0, 1.0]'\n>>> json.JSONEncoder(default=encodecomplex).encode(2 + 1j)\n'[2.0, 1.0]'\n>>> ''.join(json.JSONEncoder(default=encodecomplex).iterencode(2 + 1j))\n'[2.0, 1.0]'\n\nUsing simplejson.tool from the shell to validate and pretty-print::\n\n$ echo '{\"json\":\"obj\"}' | python -m simplejson.tool\n{\n\"json\": \"obj\"\n}\n$ echo '{ 1.2:3.4}' | python -m simplejson.tool\nExpecting property name: line 1 column 3 (char 2)\n\nParsing multiple documents serialized as JSON lines (newline-delimited JSON)::\n\n>>> import simplejson as json\n>>> def loadslines(docs):\n...     for doc in docs.splitlines():\n...         yield json.loads(doc)\n...\n>>> sum(doc[\"count\"] for doc in loadslines('{\"count\":1}\\n{\"count\":2}\\n{\"count\":3}\\n'))\n6\n\nSerializing multiple objects to JSON lines (newline-delimited JSON)::\n\n>>> import simplejson as json\n>>> def dumpslines(objs):\n...     for obj in objs:\n...         yield json.dumps(obj, separators=(',',':')) + '\\n'\n...\n>>> ''.join(dumpslines([{'count': 1}, {'count': 2}, {'count': 3}]))\n'{\"count\":1}\\n{\"count\":2}\\n{\"count\":3}\\n'\n",
            "subsections": []
        },
        "PACKAGE CONTENTS": {
            "content": "speedups\ncompat\ndecoder\nencoder\nerrors\nordereddict\nrawjson\nscanner\ntests (package)\ntool\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.ValueError(builtins.Exception)\nsimplejson.errors.JSONDecodeError\nbuiltins.dict(builtins.object)\ncollections.OrderedDict\nbuiltins.object\nsimplejson.decoder.JSONDecoder\nsimplejson.encoder.JSONEncoder\nsimplejson.rawjson.RawJSON\n",
            "subsections": [
                {
                    "name": "class JSONDecodeError",
                    "content": "|  JSONDecodeError(msg, doc, pos, end=None)\n|\n|  Subclass of ValueError with the following additional properties:\n|\n|  msg: The unformatted error message\n|  doc: The JSON document being parsed\n|  pos: The start index of doc where parsing failed\n|  end: The end index of doc where parsing failed (may be None)\n|  lineno: The line corresponding to pos\n|  colno: The column corresponding to pos\n|  endlineno: The line corresponding to end (may be None)\n|  endcolno: The column corresponding to end (may be None)\n|\n|  Method resolution order:\n|      JSONDecodeError\n|      builtins.ValueError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, msg, doc, pos, end=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  reduce(self)\n|      Helper for pickle.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ValueError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class JSONDecoder",
                    "content": "|  JSONDecoder(encoding=None, objecthook=None, parsefloat=None, parseint=None, parseconstant=None, strict=True, objectpairshook=None)\n|\n|  Simple JSON <http://json.org> decoder\n|\n|  Performs the following translations in decoding by default:\n|\n|  +---------------+-------------------+\n|  | JSON          | Python            |\n|  +===============+===================+\n|  | object        | dict              |\n|  +---------------+-------------------+\n|  | array         | list              |\n|  +---------------+-------------------+\n|  | string        | str, unicode      |\n|  +---------------+-------------------+\n|  | number (int)  | int, long         |\n|  +---------------+-------------------+\n|  | number (real) | float             |\n|  +---------------+-------------------+\n|  | true          | True              |\n|  +---------------+-------------------+\n|  | false         | False             |\n|  +---------------+-------------------+\n|  | null          | None              |\n|  +---------------+-------------------+\n|\n|  It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as\n|  their corresponding ``float`` values, which is outside the JSON spec.\n|\n|  Methods defined here:\n|\n|  init(self, encoding=None, objecthook=None, parsefloat=None, parseint=None, parseconstant=None, strict=True, objectpairshook=None)\n|      *encoding* determines the encoding used to interpret any\n|      :class:`str` objects decoded by this instance (``'utf-8'`` by\n|      default).  It has no effect when decoding :class:`unicode` objects.\n|\n|      Note that currently only encodings that are a superset of ASCII work,\n|      strings of other encodings should be passed in as :class:`unicode`.\n|\n|      *objecthook*, if specified, will be called with the result of every\n|      JSON object decoded and its return value will be used in place of the\n|      given :class:`dict`.  This can be used to provide custom\n|      deserializations (e.g. to support JSON-RPC class hinting).\n|\n|      *objectpairshook* is an optional function that will be called with\n|      the result of any object literal decode with an ordered list of pairs.\n|      The return value of *objectpairshook* will be used instead of the\n|      :class:`dict`.  This feature can be used to implement custom decoders\n|      that rely on the order that the key and value pairs are decoded (for\n|      example, :func:`collections.OrderedDict` will remember the order of\n|      insertion). If *objecthook* is also defined, the *objectpairshook*\n|      takes priority.\n|\n|      *parsefloat*, if specified, will be called with the string of every\n|      JSON float to be decoded.  By default, this is equivalent to\n|      ``float(numstr)``. This can be used to use another datatype or parser\n|      for JSON floats (e.g. :class:`decimal.Decimal`).\n|\n|      *parseint*, if specified, will be called with the string of every\n|      JSON int to be decoded.  By default, this is equivalent to\n|      ``int(numstr)``.  This can be used to use another datatype or parser\n|      for JSON integers (e.g. :class:`float`).\n|\n|      *parseconstant*, if specified, will be called with one of the\n|      following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``.  This\n|      can be used to raise an exception if invalid JSON numbers are\n|      encountered.\n|\n|      *strict* controls the parser's behavior when it encounters an\n|      invalid control character in a string. The default setting of\n|      ``True`` means that unescaped control characters are parse errors, if\n|      ``False`` then control characters will be allowed in strings.\n|\n|  decode(self, s, w=<built-in method match of re.Pattern object at 0x7f687d7e7100>, PY3=True)\n|      Return the Python representation of ``s`` (a ``str`` or ``unicode``\n|      instance containing a JSON document)\n|\n|  rawdecode(self, s, idx=0, w=<built-in method match of re.Pattern object at 0x7f687d7e7100>, PY3=True)\n|      Decode a JSON document from ``s`` (a ``str`` or ``unicode``\n|      beginning with a JSON document) and return a 2-tuple of the Python\n|      representation and the index in ``s`` where the document ended.\n|      Optionally, ``idx`` can be used to specify an offset in ``s`` where\n|      the JSON document begins.\n|\n|      This can be used to decode a JSON document from a string that may\n|      have extraneous data at the end.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                },
                {
                    "name": "class JSONEncoder",
                    "content": "|  JSONEncoder(skipkeys=False, ensureascii=True, checkcircular=True, allownan=True, sortkeys=False, indent=None, separators=None, encoding='utf-8', default=None, usedecimal=True, namedtupleasobject=True, tupleasarray=True, bigintasstring=False, itemsortkey=None, forjson=False, ignorenan=False, intasstringbitcount=None, iterableasarray=False)\n|\n|  Extensible JSON <http://json.org> encoder for Python data structures.\n|\n|  Supports the following objects and types by default:\n|\n|  +-------------------+---------------+\n|  | Python            | JSON          |\n|  +===================+===============+\n|  | dict, namedtuple  | object        |\n|  +-------------------+---------------+\n|  | list, tuple       | array         |\n|  +-------------------+---------------+\n|  | str, unicode      | string        |\n|  +-------------------+---------------+\n|  | int, long, float  | number        |\n|  +-------------------+---------------+\n|  | True              | true          |\n|  +-------------------+---------------+\n|  | False             | false         |\n|  +-------------------+---------------+\n|  | None              | null          |\n|  +-------------------+---------------+\n|\n|  To extend this to recognize other objects, subclass and implement a\n|  ``.default()`` method with another method that returns a serializable\n|  object for ``o`` if possible, otherwise it should call the superclass\n|  implementation (to raise ``TypeError``).\n|\n|  Methods defined here:\n|\n|  init(self, skipkeys=False, ensureascii=True, checkcircular=True, allownan=True, sortkeys=False, indent=None, separators=None, encoding='utf-8', default=None, usedecimal=True, namedtupleasobject=True, tupleasarray=True, bigintasstring=False, itemsortkey=None, forjson=False, ignorenan=False, intasstringbitcount=None, iterableasarray=False)\n|      Constructor for JSONEncoder, with sensible defaults.\n|\n|      If skipkeys is false, then it is a TypeError to attempt\n|      encoding of keys that are not str, int, long, float or None.  If\n|      skipkeys is True, such items are simply skipped.\n|\n|      If ensureascii is true, the output is guaranteed to be str\n|      objects with all incoming unicode characters escaped.  If\n|      ensureascii is false, the output will be unicode object.\n|\n|      If checkcircular is true, then lists, dicts, and custom encoded\n|      objects will be checked for circular references during encoding to\n|      prevent an infinite recursion (which would cause an OverflowError).\n|      Otherwise, no such check takes place.\n|\n|      If allownan is true, then NaN, Infinity, and -Infinity will be\n|      encoded as such.  This behavior is not JSON specification compliant,\n|      but is consistent with most JavaScript based encoders and decoders.\n|      Otherwise, it will be a ValueError to encode such floats.\n|\n|      If sortkeys is true, then the output of dictionaries will be\n|      sorted by key; this is useful for regression tests to ensure\n|      that JSON serializations can be compared on a day-to-day basis.\n|\n|      If indent is a string, then JSON array elements and object members\n|      will be pretty-printed with a newline followed by that string repeated\n|      for each level of nesting. ``None`` (the default) selects the most compact\n|      representation without any newlines. For backwards compatibility with\n|      versions of simplejson earlier than 2.1.0, an integer is also accepted\n|      and is converted to a string with that many spaces.\n|\n|      If specified, separators should be an (itemseparator, keyseparator)\n|      tuple.  The default is (', ', ': ') if *indent* is ``None`` and\n|      (',', ': ') otherwise.  To get the most compact JSON representation,\n|      you should specify (',', ':') to eliminate whitespace.\n|\n|      If specified, default is a function that gets called for objects\n|      that can't otherwise be serialized.  It should return a JSON encodable\n|      version of the object or raise a ``TypeError``.\n|\n|      If encoding is not None, then all input strings will be\n|      transformed into unicode using that encoding prior to JSON-encoding.\n|      The default is UTF-8.\n|\n|      If usedecimal is true (default: ``True``), ``decimal.Decimal`` will\n|      be supported directly by the encoder. For the inverse, decode JSON\n|      with ``parsefloat=decimal.Decimal``.\n|\n|      If namedtupleasobject is true (the default), objects with\n|      ``asdict()`` methods will be encoded as JSON objects.\n|\n|      If tupleasarray is true (the default), tuple (and subclasses) will\n|      be encoded as JSON arrays.\n|\n|      If *iterableasarray* is true (default: ``False``),\n|      any object not in the above table that implements ``iter()``\n|      will be encoded as a JSON array.\n|\n|      If bigintasstring is true (not the default), ints 253 and higher\n|      or lower than -253 will be encoded as strings. This is to avoid the\n|      rounding that happens in Javascript otherwise.\n|\n|      If intasstringbitcount is a positive number (n), then int of size\n|      greater than or equal to 2n or lower than or equal to -2n will be\n|      encoded as strings.\n|\n|      If specified, itemsortkey is a callable used to sort the items in\n|      each dictionary. This is useful if you want to sort items other than\n|      in alphabetical order by key.\n|\n|      If forjson is true (not the default), objects with a ``forjson()``\n|      method will use the return value of that method for encoding as JSON\n|      instead of the object.\n|\n|      If *ignorenan* is true (default: ``False``), then out of range\n|      :class:`float` values (``nan``, ``inf``, ``-inf``) will be serialized\n|      as ``null`` in compliance with the ECMA-262 specification. If true,\n|      this will override *allownan*.\n|\n|  default(self, o)\n|      Implement this method in a subclass such that it returns\n|      a serializable object for ``o``, or calls the base implementation\n|      (to raise a ``TypeError``).\n|\n|      For example, to support arbitrary iterators, you could\n|      implement default like this::\n|\n|          def default(self, o):\n|              try:\n|                  iterable = iter(o)\n|              except TypeError:\n|                  pass\n|              else:\n|                  return list(iterable)\n|              return JSONEncoder.default(self, o)\n|\n|  encode(self, o)\n|      Return a JSON string representation of a Python data structure.\n|\n|      >>> from simplejson import JSONEncoder\n|      >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n|      '{\"foo\": [\"bar\", \"baz\"]}'\n|\n|  iterencode(self, o, oneshot=False)\n|      Encode the given object and yield each string\n|      representation as available.\n|\n|      For example::\n|\n|          for chunk in JSONEncoder().iterencode(bigobject):\n|              mysocket.write(chunk)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  itemseparator = ', '\n|\n|  keyseparator = ': '\n"
                },
                {
                    "name": "class OrderedDict",
                    "content": "|  Dictionary that remembers insertion order\n|\n|  Method resolution order:\n|      OrderedDict\n|      builtins.dict\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  delitem(self, key, /)\n|      Delete self[key].\n|\n|  eq(self, value, /)\n|      Return self==value.\n|\n|  ge(self, value, /)\n|      Return self>=value.\n|\n|  gt(self, value, /)\n|      Return self>value.\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ior(self, value, /)\n|      Return self|=value.\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  le(self, value, /)\n|      Return self<=value.\n|\n|  lt(self, value, /)\n|      Return self<value.\n|\n|  ne(self, value, /)\n|      Return self!=value.\n|\n|  or(self, value, /)\n|      Return self|value.\n|\n|  reduce(...)\n|      Return state information for pickling\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  reversed(...)\n|      od.reversed() <==> reversed(od)\n|\n|  ror(self, value, /)\n|      Return value|self.\n|\n|  setitem(self, key, value, /)\n|      Set self[key] to value.\n|\n|  sizeof(...)\n|      D.sizeof() -> size of D in memory, in bytes\n|\n|  clear(...)\n|      od.clear() -> None.  Remove all items from od.\n|\n|  copy(...)\n|      od.copy() -> a shallow copy of od\n|\n|  items(...)\n|      D.items() -> a set-like object providing a view on D's items\n|\n|  keys(...)\n|      D.keys() -> a set-like object providing a view on D's keys\n|\n|  movetoend(self, /, key, last=True)\n|      Move an existing element to the end (or beginning if last is false).\n|\n|      Raise KeyError if the element does not exist.\n|\n|  pop(...)\n|      od.pop(key[,default]) -> v, remove specified key and return the corresponding value.\n|\n|      If the key is not found, return the default if given; otherwise,\n|      raise a KeyError.\n|\n|  popitem(self, /, last=True)\n|      Remove and return a (key, value) pair from the dictionary.\n|\n|      Pairs are returned in LIFO order if last is true or FIFO order if false.\n|\n|  setdefault(self, /, key, default=None)\n|      Insert key with a value of default if key is not in the dictionary.\n|\n|      Return the value for key if key is in the dictionary, else default.\n|\n|  update(...)\n|      D.update([E, ]F) -> None.  Update D from dict/iterable E and F.\n|      If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]\n|      If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v\n|      In either case, this is followed by: for k in F:  D[k] = F[k]\n|\n|  values(...)\n|      D.values() -> an object providing a view on D's values\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  fromkeys(iterable, value=None) from builtins.type\n|      Create a new ordered dictionary with keys from iterable and values set to value.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  hash = None\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.dict:\n|\n|  contains(self, key, /)\n|      True if the dictionary has the specified key, else False.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  getitem(...)\n|      x.getitem(y) <==> x[y]\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  get(self, key, default=None, /)\n|      Return the value for key if key is in the dictionary, else default.\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from builtins.dict:\n|\n|  classgetitem(...) from builtins.type\n|      See PEP 585\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.dict:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n"
                },
                {
                    "name": "class RawJSON",
                    "content": "|  RawJSON(encodedjson)\n|\n|  Wrap an encoded JSON document for direct embedding in the output\n|\n|  Methods defined here:\n|\n|  init(self, encodedjson)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "dump",
                    "content": "Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n``.write()``-supporting file-like object).\n\nIf *skipkeys* is true then ``dict`` keys that are not basic types\n(``str``, ``int``, ``long``, ``float``, ``bool``, ``None``)\nwill be skipped instead of raising a ``TypeError``.\n\nIf *ensureascii* is false (default: ``True``), then the output may\ncontain non-ASCII characters, so long as they do not need to be escaped\nby JSON. When it is true, all non-ASCII characters are escaped.\n\nIf *allownan* is false, then it will be a ``ValueError`` to\nserialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)\nin strict compliance of the original JSON specification, instead of using\nthe JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). See\n*ignorenan* for ECMA-262 compliant behavior.\n\nIf *indent* is a string, then JSON array elements and object members\nwill be pretty-printed with a newline followed by that string repeated\nfor each level of nesting. ``None`` (the default) selects the most compact\nrepresentation without any newlines.\n\nIf specified, *separators* should be an\n``(itemseparator, keyseparator)`` tuple.  The default is ``(', ', ': ')``\nif *indent* is ``None`` and ``(',', ': ')`` otherwise.  To get the most\ncompact JSON representation, you should specify ``(',', ':')`` to eliminate\nwhitespace.\n\n*encoding* is the character encoding for str instances, default is UTF-8.\n\n*default(obj)* is a function that should return a serializable version\nof obj or raise ``TypeError``. The default simply raises ``TypeError``.\n\nIf *usedecimal* is true (default: ``True``) then decimal.Decimal\nwill be natively serialized to JSON with full precision.\n\nIf *namedtupleasobject* is true (default: ``True``),\n:class:`tuple` subclasses with ``asdict()`` methods will be encoded\nas JSON objects.\n\nIf *tupleasarray* is true (default: ``True``),\n:class:`tuple` (and subclasses) will be encoded as JSON arrays.\n\nIf *iterableasarray* is true (default: ``False``),\nany object not in the above table that implements ``iter()``\nwill be encoded as a JSON array.\n\nIf *bigintasstring* is true (default: ``False``), ints 253 and higher\nor lower than -253 will be encoded as strings. This is to avoid the\nrounding that happens in Javascript otherwise. Note that this is still a\nlossy operation that will not round-trip correctly and should be used\nsparingly.\n\nIf *intasstringbitcount* is a positive number (n), then int of size\ngreater than or equal to 2n or lower than or equal to -2n will be\nencoded as strings.\n\nIf specified, *itemsortkey* is a callable used to sort the items in\neach dictionary. This is useful if you want to sort items other than\nin alphabetical order by key. This option takes precedence over\n*sortkeys*.\n\nIf *sortkeys* is true (default: ``False``), the output of dictionaries\nwill be sorted by item.\n\nIf *forjson* is true (default: ``False``), objects with a ``forjson()``\nmethod will use the return value of that method for encoding as JSON\ninstead of the object.\n\nIf *ignorenan* is true (default: ``False``), then out of range\n:class:`float` values (``nan``, ``inf``, ``-inf``) will be serialized as\n``null`` in compliance with the ECMA-262 specification. If true, this will\noverride *allownan*.\n\nTo use a custom ``JSONEncoder`` subclass (e.g. one that overrides the\n``.default()`` method to serialize additional types), specify it with\nthe ``cls`` kwarg. NOTE: You should use *default* or *forjson* instead\nof subclassing whenever possible.\n"
                },
                {
                    "name": "dumps",
                    "content": "Serialize ``obj`` to a JSON formatted ``str``.\n\nIf ``skipkeys`` is false then ``dict`` keys that are not basic types\n(``str``, ``int``, ``long``, ``float``, ``bool``, ``None``)\nwill be skipped instead of raising a ``TypeError``.\n\nIf *ensureascii* is false (default: ``True``), then the output may\ncontain non-ASCII characters, so long as they do not need to be escaped\nby JSON. When it is true, all non-ASCII characters are escaped.\n\nIf ``checkcircular`` is false, then the circular reference check\nfor container types will be skipped and a circular reference will\nresult in an ``OverflowError`` (or worse).\n\nIf ``allownan`` is false, then it will be a ``ValueError`` to\nserialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in\nstrict compliance of the JSON specification, instead of using the\nJavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).\n\nIf ``indent`` is a string, then JSON array elements and object members\nwill be pretty-printed with a newline followed by that string repeated\nfor each level of nesting. ``None`` (the default) selects the most compact\nrepresentation without any newlines. For backwards compatibility with\nversions of simplejson earlier than 2.1.0, an integer is also accepted\nand is converted to a string with that many spaces.\n\nIf specified, ``separators`` should be an\n``(itemseparator, keyseparator)`` tuple.  The default is ``(', ', ': ')``\nif *indent* is ``None`` and ``(',', ': ')`` otherwise.  To get the most\ncompact JSON representation, you should specify ``(',', ':')`` to eliminate\nwhitespace.\n\n``encoding`` is the character encoding for bytes instances, default is\nUTF-8.\n\n``default(obj)`` is a function that should return a serializable version\nof obj or raise TypeError. The default simply raises TypeError.\n\nIf *usedecimal* is true (default: ``True``) then decimal.Decimal\nwill be natively serialized to JSON with full precision.\n\nIf *namedtupleasobject* is true (default: ``True``),\n:class:`tuple` subclasses with ``asdict()`` methods will be encoded\nas JSON objects.\n\nIf *tupleasarray* is true (default: ``True``),\n:class:`tuple` (and subclasses) will be encoded as JSON arrays.\n\nIf *iterableasarray* is true (default: ``False``),\nany object not in the above table that implements ``iter()``\nwill be encoded as a JSON array.\n\nIf *bigintasstring* is true (not the default), ints 253 and higher\nor lower than -253 will be encoded as strings. This is to avoid the\nrounding that happens in Javascript otherwise.\n\nIf *intasstringbitcount* is a positive number (n), then int of size\ngreater than or equal to 2n or lower than or equal to -2n will be\nencoded as strings.\n\nIf specified, *itemsortkey* is a callable used to sort the items in\neach dictionary. This is useful if you want to sort items other than\nin alphabetical order by key. This option takes precedence over\n*sortkeys*.\n\nIf *sortkeys* is true (default: ``False``), the output of dictionaries\nwill be sorted by item.\n\nIf *forjson* is true (default: ``False``), objects with a ``forjson()``\nmethod will use the return value of that method for encoding as JSON\ninstead of the object.\n\nIf *ignorenan* is true (default: ``False``), then out of range\n:class:`float` values (``nan``, ``inf``, ``-inf``) will be serialized as\n``null`` in compliance with the ECMA-262 specification. If true, this will\noverride *allownan*.\n\nTo use a custom ``JSONEncoder`` subclass (e.g. one that overrides the\n``.default()`` method to serialize additional types), specify it with\nthe ``cls`` kwarg. NOTE: You should use *default* instead of subclassing\nwhenever possible.\n"
                },
                {
                    "name": "load",
                    "content": "Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\na JSON document as `str` or `bytes`) to a Python object.\n\n*encoding* determines the encoding used to interpret any\n`bytes` objects decoded by this instance (``'utf-8'`` by\ndefault). It has no effect when decoding `str` objects.\n\n*objecthook*, if specified, will be called with the result of every\nJSON object decoded and its return value will be used in place of the\ngiven :class:`dict`.  This can be used to provide custom\ndeserializations (e.g. to support JSON-RPC class hinting).\n\n*objectpairshook* is an optional function that will be called with\nthe result of any object literal decode with an ordered list of pairs.\nThe return value of *objectpairshook* will be used instead of the\n:class:`dict`.  This feature can be used to implement custom decoders\nthat rely on the order that the key and value pairs are decoded (for\nexample, :func:`collections.OrderedDict` will remember the order of\ninsertion). If *objecthook* is also defined, the *objectpairshook*\ntakes priority.\n\n*parsefloat*, if specified, will be called with the string of every\nJSON float to be decoded.  By default, this is equivalent to\n``float(numstr)``. This can be used to use another datatype or parser\nfor JSON floats (e.g. :class:`decimal.Decimal`).\n\n*parseint*, if specified, will be called with the string of every\nJSON int to be decoded.  By default, this is equivalent to\n``int(numstr)``.  This can be used to use another datatype or parser\nfor JSON integers (e.g. :class:`float`).\n\n*parseconstant*, if specified, will be called with one of the\nfollowing strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``.  This\ncan be used to raise an exception if invalid JSON numbers are\nencountered.\n\nIf *usedecimal* is true (default: ``False``) then it implies\nparsefloat=decimal.Decimal for parity with ``dump``.\n\nTo use a custom ``JSONDecoder`` subclass, specify it with the ``cls``\nkwarg. NOTE: You should use *objecthook* or *objectpairshook* instead\nof subclassing whenever possible.\n"
                },
                {
                    "name": "loads",
                    "content": "Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\ndocument) to a Python object.\n\n*encoding* determines the encoding used to interpret any\n:class:`bytes` objects decoded by this instance (``'utf-8'`` by\ndefault). It has no effect when decoding :class:`unicode` objects.\n\n*objecthook*, if specified, will be called with the result of every\nJSON object decoded and its return value will be used in place of the\ngiven :class:`dict`.  This can be used to provide custom\ndeserializations (e.g. to support JSON-RPC class hinting).\n\n*objectpairshook* is an optional function that will be called with\nthe result of any object literal decode with an ordered list of pairs.\nThe return value of *objectpairshook* will be used instead of the\n:class:`dict`.  This feature can be used to implement custom decoders\nthat rely on the order that the key and value pairs are decoded (for\nexample, :func:`collections.OrderedDict` will remember the order of\ninsertion). If *objecthook* is also defined, the *objectpairshook*\ntakes priority.\n\n*parsefloat*, if specified, will be called with the string of every\nJSON float to be decoded.  By default, this is equivalent to\n``float(numstr)``. This can be used to use another datatype or parser\nfor JSON floats (e.g. :class:`decimal.Decimal`).\n\n*parseint*, if specified, will be called with the string of every\nJSON int to be decoded.  By default, this is equivalent to\n``int(numstr)``.  This can be used to use another datatype or parser\nfor JSON integers (e.g. :class:`float`).\n\n*parseconstant*, if specified, will be called with one of the\nfollowing strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``.  This\ncan be used to raise an exception if invalid JSON numbers are\nencountered.\n\nIf *usedecimal* is true (default: ``False``) then it implies\nparsefloat=decimal.Decimal for parity with ``dump``.\n\nTo use a custom ``JSONDecoder`` subclass, specify it with the ``cls``\nkwarg. NOTE: You should use *objecthook* or *objectpairshook* instead\nof subclassing whenever possible.\n"
                },
                {
                    "name": "simple_first",
                    "content": "Helper function to pass to itemsortkey to sort simple\nelements to the top, then container elements.\n"
                }
            ]
        },
        "DATA": {
            "content": "all = ['dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONDecod...\n",
            "subsections": []
        },
        "VERSION": {
            "content": "3.17.6\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Bob Ippolito <bob@redivi.com>\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3/dist-packages/simplejson/init.py\n\n",
            "subsections": []
        }
    },
    "summary": "simplejson",
    "flags": [],
    "examples": [],
    "see_also": []
}