我无法解析JSON. 我JSON从requests.post响应中返回的代码段:-{'result': {'parent': '', 'reason': '', 'made_sla': 'true', 'backout_plan': '', 'watch_list': '', 'upon_reject': 'cancel', 'sys_updated_on': '2018-08-22 11:16:09', 'type': 'Comprehensive', 'conflict_status': 'Not Run', 'approval_history': '', 'number': 'CHG0030006', 'test_plan': '', 'cab_delegate': '', 'sys_updated_by': 'admin', 'opened_by': {'link': 'https://dev65345.service-now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441', 'value': '6816f79cc0a8016401c5a33be04be441'}, 'user_input': '', 'requested_by_date': '', 'sys_created_on': '2018-08-22 11:16:09', 'sys_domain': {'link': 'https://dev65345.service-now.com/api/now/table/sys_user_group/global', 'value': 'global'}, 'state': '-5', 'sys_created_by': 'admin', 'knowledge': 'false', 'order': '', 'phase': 'requested', 'closed_at': '', 'cmdb_ci': '', 'delivery_plan': '', 'impact': '3', 'active': 'true', 'review_comments': '', 'work_notes_list': '', 'business_service': '', 我在网上搜索。它显示为单引号,它没有解析。因此,我尝试将单引号转换为双引号。with open ('output.json','r') as handle: handle=open('output.json')str="123"str=handle.stringify() #also with .str()str = str.replace("\'", "\"")jsonobj=json.load(json.dumps(handle))但是它向我展示了No attribute stringify or str它是一个json对象,并且这些都是字符串对象函数。那么,请您帮我看看json在文件中用单引号解析对象的正确方法是什么。
添加回答
举报
0/150
提交
取消