xelement - How to retrieve values by index from a dynamic Object -


            string zohoresponse = @"      [       {         'title':'mr.',         'first name':'ram',         'last name':'chang',         'employed @ trade client name':'mile travel',         'telephone':'657498333',         'e-mail':'abc@traveller.com',         'fax':' ',         'street':'123 street',         'city':'winnipeg',         'state / province':'manitoba',         'country':'canada',         'postcode':'r4t 600',         'agent id':70,         'primary sales agent':' ',         'employed @ from':'09/12/2008',         'employed @ to':'09/12/2028'       }              ]         ";        dynamic jsonobj = jsonconvert.deserializeobject(zohoresponse);            xmldata = new xdocument(                             `enter code here`  new xelement("leads",                                   new xelement("row", new xattribute("no", "1"),                                   new xelement("fl", new xattribute("val", "lead source"), jsonobj["last name"]),                                  new xelement("fl", new xattribute("val", "title"),  jsonobj["first name"])                            ))); 

i want retrieve dynamic index values. have used new

xelement("fl", new xattribute("val", "title"), jsonobj.gettype().getproperty("title").getvalue(jsonobj,null)) still getting exception on retrieve values index

jsonobj array need reach first element in array first before querying json literal.

dynamic jsonobj = jsonconvert.deserializeobject(zohoresponse); dynamic arr = jsonobj.first;  var xmldata = new xdocument(                     new xelement("leads",                             new xelement("row", new xattribute("no", "1"),                             new xelement("fl", new xattribute("val", "lead source"), arr["last name"]),                         new xelement("fl", new xattribute("val", "title"), arr["first name"])                     ))); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -