I have this string below with '\\t', '\\r' and '\\n' which I need to convert to a valid Json format with a loop so that I can Deserializeto an object without listing the 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 to solve your problem.
\\r\\n
- this will give you individual rows with data \\t
symbol - this will give you array of properties new { firstName = arrayData[0], lastName = arrayData[1], ..}
, or you can create a new class with all the required properties Json.NET
library for this purpose: http://www.newtonsoft.com/json
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.