-2

string source

{
"Amount": 16700000,
"CardNumber": "0095",
"MerchantReference": "7654325",
"PaymentReference": "FBN|WEB|WEBP|3-02-2016|170619",
"RetrievalReferenceNumber": "000000088836",
"LeadBankCbnCode": null,
"LeadBankName": null,
"SplitAccounts": [],
"TransactionDate": "2016-02-03T16:41:43.923",
"ResponseCode": "00",
"ResponseDescription": "Approved Successful"
}

how do I get the values of Transaction Date,ResponseDescription and Transaction date with c#. Thank you

0

1 Answer 1

1

Have a look to this library : https://www.nuget.org/packages/Newtonsoft.Json. Here is the code. First of all, define your object in which you want to put the values. Exemple :

[Serializable]
public class TransactionResponse
{
    public DateTime TransactionDate { get; set; }
    public string ResponseCode { get; set; }
    public string ResponseDescription { get; set; }
}

And then, use your class like that :

using Newtonsoft.Json;

...

string jsonContent = @"{
""Amount"": 16700000,
""CardNumber"": ""0095"",
""MerchantReference"": ""7654325"",
""PaymentReference"": ""FBN|WEB|WEBP|3-02-2016|170619"",
""RetrievalReferenceNumber"": ""000000088836"",
""LeadBankCbnCode"": null,
""LeadBankName"": null,
""SplitAccounts"": [],
""TransactionDate"": ""2016-02-03T16:41:43.923"",
""ResponseCode"": ""00"",
""ResponseDescription"": ""Approved Successful""
}";

var response = JsonConvert.DeserializeObject<TransactionResponse>(jsonContent);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.