这是我的 webInvoke
[WebInvoke(
Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "{invoice}/{transtype}/"
)
]
我有这个返回码
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("ApprovalStatus", response.ApprovalStatus);
dic.Add("AuthorizationCode", response.AuthorizationCode);
dic.Add("CardBalance", response.CardBalance);
dic.Add("ErrorMessage", response.ErrorMessage);
dic.Add("InvoiceNumber", response.InvoiceNumber);
return dic;
我的问题是它没有返回有效的 JSON 数组
样本结果
[{"Key":"ApprovalStatus","Value":"CAPTURED"},{"Key":"AuthorizationCode","Value":"TAS926"},{"Key":"CardBalance","Value":null},{"Key":"ErrorMessage","Value":""},{"Key":"InvoiceNumber","Value":"1"},{"Key":"ReferenceNumber","Value":"313506502708"},{"Key":"UniqueCode","Value":"2704"}]
我怎样才能使它成为一个 JSON 数组?