
一、JSON介绍
JSON表示JAVA小号scriptobjectn浮选是以一种有组织且简单的方式存储信息的。当浏览器与服务器之间进行数据交换时,数据必须是文本格式。
二、JSON字符串转换Python
1.使用以下代码示例
importjson
people_string='''
{
"people":[
{
"emp_name":"Johnsmith",
"emp_no.":"924367-567-23",
"emp_email":["johnsmith@dummyemail.com"],
"has_license":"false"
},
{
"emp_name":"harshitkant",
"emp_number":"560-555-5153",
"emp_email":"null",
"has_license":"true"
}
]
}
'''
data=json.loads(people_string)
print(data)
2.输出

3.打印数据类型
importjson
people_string='''
{
"people":[
{
"emp_name":"Johnsmith",
"emp_no.":"924367-567-23",
"emp_email":["johnsmith@dummyemail.com"],
"has_license":"false"
},
{
"emp_name":"harshitkant",
"emp_number":"560-555-5153",
"emp_email":"null",
"has_license":"true"
}
]
}
'''
data=json.loads(people_string)
print(type(data))#printsthedatatype
输出:
<class'dict'>
JSON相关知识点学习推荐阅读:
json和python字典区别