import json
a={'name':'idoxu','sex':'male','age':30}
b=json.dumps(a)#把字典转为json
print('{},{}'.format(b,type(b)))
#json的格式是字符串
c='{"name":"idoxu","sex":"male","age":30}'
d=json.loads(c)#json转为dict
#the JSON object must be str, bytes or bytearray, not dict
print('{},{}'.format(d,type(d)))
e={"name":"idoxu","sex":"male","age":30}
print('{},{}'.format(e,type(e)))
{“name”: “idoxu”, “sex”: “male”, “age”: 30},
{‘name’: ‘idoxu’, ‘sex’: ‘male’, ‘age’: 30},
{‘name’: ‘idoxu’, ‘sex’: ‘male’, ‘age’: 30},