3 回答

TA貢獻(xiàn)1934條經(jīng)驗(yàn) 獲得超2個(gè)贊
您的 emvTagData 是一個(gè)文字字符串,但您正試圖將其反序列化為一個(gè)復(fù)雜的對(duì)象。
"emvTagData":"{\"TVR\":\"0200008000\",\"PIN\":\"None\",\"Signature\":\"true\",\"Mode\":\"Issuer\",\"ARC\":\"Z3\",\"TSI\":\"E800\",\"Application Preferred Name\":\"CREDITO DE VISA\",\"AID\":\"A0000000031010\",\"IAD\":\"06010A03A00000\",\"Entry method\":\"Chip Read\",\"Application Label\":\"VISA CREDIT\"}"
看到您已經(jīng)將它作為string
類中注釋掉的類型,AuthCardResponse
我希望您已經(jīng)發(fā)現(xiàn)可以將其反序列化為string
.

TA貢獻(xiàn)1865條經(jīng)驗(yàn) 獲得超7個(gè)贊
您可以在線使用 JSON to Csharp 檢查您的 C# 類
您需要更多步驟才能通過Deserialize
emvTagData 為您的對(duì)象獲取結(jié)果。
使用您的 JSON 數(shù)據(jù),您的課程應(yīng)該是
public class RootObject
{
public string amount { get; set; }
public string resptext { get; set; }
public string cvvresp { get; set; }
public string respcode { get; set; }
public string avsresp { get; set; }
public string merchid { get; set; }
public string token { get; set; }
public string authcode { get; set; }
public string respproc { get; set; }
public string emvTagData { get; set; }
public string retref { get; set; }
public string respstat { get; set; }
public string account { get; set; }
}

TA貢獻(xiàn)1735條經(jīng)驗(yàn) 獲得超5個(gè)贊
您的 json 的 Newtonsoft.Json 語法錯(cuò)誤。您的 json 中的對(duì)象 (EmvTagData) 應(yīng)如下所示:
"emvTagData": {
"TVR": "0200008000",
"PIN": "None",
"Signature": "true",
"Mode": "Issuer",
"ARC": "Z3",
"TSI": "E800",
"Application Preferred Name": "CREDITO DE VISA",
"AID": "A0000000031010",
"IAD": "06010A03A00000",
"Entry method": "Chip Read",
"Application Label": "VISA CREDIT"}
主括號(hào)前后沒有 \" 和 "。
整個(gè) json :
{"amount":"3.00","resptext":"Approval","cvvresp":"P","respcode":"000","avsresp":"","merchid":"800000000800","token":"9478837814450119","authcode":"PPS306","respproc":"RPCT","emvTagData":{"TVR":"0200008000","PIN":"None","Signature":"true","Mode":"Issuer","ARC":"Z3","TSI":"E800","Application Preferred Name":"CREDITO DE VISA","AID":"A0000000031010","IAD":"06010A03A00000","Entry method":"Chip Read","Application Label":"VISA CREDIT"},"retref":"116390139157","respstat":"A","account":"47XXXXXXXXXX0119"}
- 3 回答
- 0 關(guān)注
- 183 瀏覽
添加回答
舉報(bào)