Auto Convert Json String to C# Object -
i have string below '\t', '\r' , '\n' need convert valid json format loop can deserializeto object without listing object properties.
"title\tfirstname\tlastname\tage\r\nmr\tbla bla\tbla bla\t25\r\nmiss\tbla bla\tbla bla\t35\r\n"
you can use string.split method solve problem.
- first of need split
\r\n
- give individual rows data - you can loop through these rows , split each of them
\t
symbol - give array of properties - after have "ingredients" - can build objects: using dynamic objects
new { firstname = arraydata[0], lastname = arraydata[1], ..}
, or can create new class required properties - last step serialize collection of objects json - recommend
json.net
library purpose: http://www.newtonsoft.com/json
Comments
Post a Comment