importar json
Python a json: json.dumps (obj)
json a python: json.loads (obj)
import json "" " json python []: Lista de matriz en la lista json {}: Diccionario de objetos en json dict verdadero Verdadero nulo Ninguno falso Falso " "" li = [11,22,33,44 , Verdadero, Ninguno] # Convierta los datos de Python a datos json res_1 = json.dumps (li) print (res_1, type (res_1)) dic = { " a " : 1, " b " : True, " c " :Ninguno} res_2 =json.dumps (dic) print (res_2, type (res_2)) # json 转换 为python js1 = ' {"a": true, "b": false} ' res3 = json.loads (js1) print (res3, type (res3))