语言数据类型
1.JavaScript将对象转换成字符串
li = [1,2,3,4]
(4) [1, 2, 3, 4]
JSON.stringify(li)
"[1,2,3,4]"
2.JavaScript将字符串转换成对象
s = JSON.stringify(li)
"[1,2,3,4]"
JSON.parse(s)
(4) [1, 2, 3, 4]
3.python3字段转换成字符串
import json ret = {'status': True, 'error': None, 'data': '111'} #字典转换成字符串 result = json.dumps(ret) print(result) print(type(result)) ''' 输出: {"status": true, "error": null, "data": "111"} <class 'str'> '''