im new in C#.
How to get JSON POST data?
I have an service that POST JSON data to my asp.net.
Here the data:
{
"transaction_time": "2017-09-18 09:47:54",
"transaction_status": "capture",
"transaction_id": "b7c8cfa9-b706-4a9d-b70d-8d70149145bd",
"status_message": "Veritrans payment notification",
"status_code": "200",
"signature_key": "b22b5740bf2c587ba949ae5343757a66e5a75c45b9377b9ee891909bbd8977bb2caea8e0549bf09b5040b22f54efc76aa8beb31e321f9d600f267b23f37b30ae",
"payment_type": "credit_card",
"order_id": "LUHUMMLWOT",
"masked_card": "401111-1112",
"gross_amount": "326000.00",
"fraud_status": "accept",
"bank": "mandiri",
"approval_code": "1505702878234"
}
As far I know, I can catch all data using WebMethod, create an method then initialize the parameter each JSON object, but every post, they send different JSON. So I must get all JSON and parse it into variable dynamically.
Please help :)
Thanks~
JsonConvert.DeserializeObject(yourJson)you will need to include theusing Newtonsoft.Json;statement in your code.