![]() Return value of object_pairs_hook will be used instead of theĭict. Result of any object literal decoded with an ordered list of pairs. Object_pairs_hook is an optional function that will be called with the Object_hook will be used instead of the dict. Object_hook is an optional function that will be called with the result ofĪny object literal decoded (a dict). ![]() To a unicode object and passed to loads(). Should be wrapped with codecs.getreader(encoding)(fp), or simply decoded latin-1), then an appropriate encoding name must be specified.Įncodings that are not ASCII based (such as UCS-2) are not allowed, and If the contents of fp are encoded with an ASCII based encoding other than read()-supporting file-like objectĬontaining a JSON document) to a Python object using this conversion load ( fp ] ] ] ] ] ] ] ) ¶ĭeserialize fp (a. That is, loads(dumps(x)) != x if x has non-string Into JSON and then back into a dictionary, the dictionary may not equal As a result of this, if a dictionary is converted WhenĪ dictionary is converted into JSON, all the keys of the dictionary areĬoerced to strings. Keys in key/value pairs of JSON are always of the type str. Members will be pretty-printed with that indent level. If indent is a non-negative integer, then JSON array elements and object Using the JavaScript equivalents ( NaN, Infinity, -Infinity). Inf, -inf) in strict compliance of the JSON specification, instead of ValueError to serialize out of range float values ( nan, If allow_nan is False (default: True), then it will be a Will result in an OverflowError (or worse). Reference check for container types will be skipped and a circular reference If check_circular is False (default: True), then the circular Unless fp.write()Įxplicitly understands unicode (as in codecs.getwriter()) Unicode strings or the encoding parameter is used. This usually happens because the input contains ![]() IfĮnsure_ascii is False, some chunks written to fp may be Str instance consisting of ASCII characters only. ![]() Output are escaped with \uXXXX sequences, and the result is a If ensure_ascii is True (the default), all non-ASCII characters in the Of a basic type ( str, unicode, int, long,įloat, bool, None) will be skipped instead of raising a If skipkeys is True (default: False), then dict keys that are not write()-supportingįile-like object) using this conversion table. Serialize obj as a JSON formatted stream to fp (a. dump ( obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding="utf-8", default=None, sort_keys=False, **kw ) ¶ ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |