【问题标题】:cannot deserialize the current json object Message shows when I try to read the below Json data into Objects无法反序列化当前的 json 对象 当我尝试将以下 Json 数据读入对象时显示消息
【发布时间】:2021-02-08 20:17:46
【问题描述】:

在尝试将以下 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="
}

【问题讨论】:

  • 嗨,Paapu,谢谢您的提问。有几种方法可以改善您的问题:我们可以从您的标签中推断出来(它看起来像 C#),列出您正在使用的技术仍然很有帮助;请提供您尝试过的代码。

标签: c# json json-deserialization


【解决方案1】:

为自己找一个支持 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": 之后,你应该是有效的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-16
    • 1970-01-01
    • 1970-01-01
    • 2021-12-03
    • 1970-01-01
    相关资源
    最近更新 更多