json.dumps()
将 Python 对象编码成 JSON 字符串
json.dumps(obj, 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)
json.loads()
将已编码的 JSON 字符串解码为 Python 对象
json.loads(s[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]])
Encoders and Decoders
Json | Python |
---|---|
object | dict |
array | list |
string | str |
number(int) | int |
true | True |
false | False |
null | None |
Python | Json |
---|---|
dict | object |
list, tuple | array |
str | string |
int, float, int- & float-derived Enums | number |
True | true |
False | false |
None | null |