HI WELCOME TO KANSIRIS

convert 'Newtonsoft.Json.Linq.JArray' to type object

Leave a Comment
create classes as 
  class Student        {            public string id { get; set; }            public string entity { get; set; }            public string amount { get; set; }            public string currency { get; set; }            public string status { get; set; }            public string order_id { get; set; }            public string invoice_id { get; set; }            public string international { get; set; }            public string method { get; set; }            public string amount_refunded { get; set; }            public string refund_status { get; set; }            public string captured { get; set; }            public string description { get; set; }            public string card_id { get; set; }            public string bank { get; set; }            public string wallet { get; set; }            public string vpa { get; set; }            public string email { get; set; }            public List<ResponseData> notes { get; set; }
            public string contact { get; set; }            public string  fee { get; set; }            public string tax { get; set; }            public string error_code { get; set; }            public string error { get; set; }            public string created_at { get; set; }                    }        public class ResponseData        {            public string address { get; set; }            public string order_id { get; set; }        }
json file is

 var payme1.Attributes = {{
                        //  "id": "pay_AV3zZkXnBruzMh",
                        //  "entity": "payment",
                        //  "amount": 6300000,
                        //  "currency": "INR",
                        //  "status": "authorized",
                        //  "order_id": null,
                        //  "invoice_id": null,
                        //  "international": false,
                        //  "method": "card",
                        //  "amount_refunded": 0,
                        //  "refund_status": null,
                        //  "captured": false,
                        //  "description": "ahwanam.com",
                        //  "card_id": "card_AV3zao0kIZ79p7",
                        //  "bank": null,
                        //  "wallet": null,
                        //  "vpa": null,
                        //  "email": "kansiris@ks.com",
                        //  "contact": "+917780352828",
                        //  "notes": {
                        //                            "address": "Hello World"
                        //  },
                        //  "fee": null,
                        //  "tax": null,
                        //  "error_code": null,
                        //  "error_description": null,
                        //  "created_at": 1530687872
                        //}
                        //                }




 var ks = JsonConvert.SerializeObject(payme1.Attributes);
                        Student studentArray = JsonConvert.DeserializeObject<Student>(ks);

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.