c# - 无法反序列化当前的 json 对象 当我尝试将以下 Json 数据读入对象时显示消息
问题描述
尝试将以下 JSON 内容反序列化为对象时遇到问题,尤其是eInv
部分内容
{
"requestType": "SaveDocuments",
"status": "P",
"version": "v0.1",
"validationReport": null,
"dataReport": [
{
"locationGstin": "DSAJJ0AAGCR31",
"locationName": "ABC MARKET",
"documentNumber": "2947",
"documentDate": "23-10-2020",
"billFromGstin": "DDLDF07AAGCL",
"supplyType": "S",
"documentType": "LST",
"portCode": null,
"custom1": null,
"custom2": null,
"custom3": null,
"custom4": null,
"custom5": null,
"custom6": null,
"custom7": null,
"custom8": null,
"custom9": null,
"custom10": null,
"eInv": {
"ackNumber": "1721101",
"ackDate": "01-02-2021 18:54:00",
"irn": "2d9a39998157b984276e6f1d3b8f74597d7850f0b7ba88c251556e4436b2bb0e",
"signedInvoice": "CJWeJKYynrWOw2k-GLO-vDipfOohtqW1xh5bg",
"signedQRCode": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjQe5VoYONjADbEYzGABzAz8cCyLXDfNENkZ_TXHw",
"qrCode": "iVBORw0KGgoAAAANSUhEUgAAAG0AAABtCAYAAACrXCIc",
"qrCodeData": "{\"SellerGstin\":\"abc\",\"BuyerGstin\":\"def\",\"DocNo\":\"234\",\"DocTyp\":\"ghi\",\"DocDt\":\"23/10/2020\",\"TotInvVal\":4005.00,\"ItemCnt\":4,\"MainHsnCode\":\"abc\",\"Irn\":\"321absd432\",\"IrnDt\":\"2021-02-01 18:54:00\"}",
"errors": null
},
"propertyErrors": null
}
],
"referenceId": "abcdesf="
}
解决方案
为自己找一个支持 JSON 的编辑器,例如 Visual Studio Code,或者任何在线 JSON 查看器的 Google,并养成使用这些工具检查 JSON 的习惯。
例如,https: //jsoneditoronline.org/#left=local.taxoru&right=local.hucize 在您的 JSON 中出现此错误:
Parse error on line 3:
...", "qrCodeData": "{"SellerGstin":"abc","
-----------------------^
删除第一个"
之后"qrCodeData":
,你应该是有效的。
推荐阅读
- firebase - 只有用户可以修改在 Firebase 中有自己的数据
- android - 在活动中的片段中按下后退按钮后出现空白屏幕
- image-masking - 重叠发生而不是在掩码上上传图像
- c++ - 为什么调用复制构造函数
- r - 如何在R中创建坐标系并定位点?
- python - Matplotlib(pyplot) 'str' 对象在尝试更改 y-label 时不可调用
- c# - 无法检索使用应用程序权限与用户共享的 OneDrive 文件
- shell - 仅允许指定字符,否则 null 应在 unix 中传输
- mysql - 使用 Laravel Forge 和 Digital Ocean 拒绝 Mysql 访问
- c# - 项目设置中的条件自定义操作