python 字典与json 格式的相互转化

1、在python表示 假---False ; 在 json 假---false
2、在python表示 空---None;  在json    空 null
# json 转化为字典
import json
str1 = '{"info":false}'
str11 = json.loads(str1)
print(str11,type(str11)) #{'info': False} <class 'dict'>

# 字典转json
str2= {"info":None}
str3 = json.dumps(str2)
print(str3,type(str3)) #{"info": null} <class 'str'>
世界上最美的风景,是自己努力的模样
原文地址:https://www.cnblogs.com/xiong-hua/p/15152708.html