返回

python——将字符串转换为json

发布时间:2022-03-08 10:42:39 263
# node.js

我相信下面的字符串是json格式的,但当我试图将字符串加载到json变量中,以便轻松查询和提取数据时,它会出错。

jdata = '
{\n    "askId": "AAABB110-000011",\n    "dateCreated": "2009-09-01T00:00:00.000Z",\n    "dateUpdated": "2021-06-24T00:00:00.000Z",\n    "owners": [\n        {\n            "ownerType": "Service-Level Owner",\n            "VendorId": "000111222"\n        },\n        {\n            "ownerType": "Technical Owner",\n            "CustomerId": "000333444"\n        },\n        {\n            "ownerType": "Business Owner",\n            "ServiceId": "000005556"\n        }\n    ],\n    "createdBy": "SYSTEM",\n    "lastUpdatedBy": "000667778",\n    "applicationName": "Treasury Bank Data",\n    "description": "Process Data",\n    "aliases": [\n        "Treasury Bank Data",\n        "Bank Data",\n        "Bank Reconciliation",\n        "Bank Rec",\n        "SERV-X"\n    ],\n    "billingBusinessSegmentId": 6,\n    "category": {\n        "categoryId": 1,\n        "categoryName": "Application"\n    },\n    "lifecycleStage": {\n        "lifecycleStageId": 3,\n        "lifecycleStageName": "Production"\n    },\n    "acquiredEntity": {\n        "acquiredEntityId": 0,\n        "acquiredEntityName": "Not Applicable"\n    },\n    "enclaveEnvironment": {\n        "enclaveEnvironmentId": 0,\n        "enclaveEnvironmentName": "General Hosting (Internal, Cloud, or Vendor hosted)"\n    },\n    "softwareType": {\n        "softwareTypeId": 7,\n        "softwareTypeName": "Vendor Product"\n    },\n    "infrastructureRequired": false,\n    "uhgHelpdeskRequired": false,\n    "references": [\n        {\n            "referenceType": "disaster-recovery",\n            "referenceValue": "APPX009919"\n        }\n    ]\n}\n
' jsonData = json.loads(jdata)

一旦我尝试将数据加载到jsonData变量中,我就会得到下面的错误。

Expecting value: line 1 column 1 (char 0)

我的字符串不允许作为json变量加载,是否有问题?

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像