Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
how to iterate the object and print the property and valu
Ravi Patel
Dec 13 2016 8:08 AM
213
Reply
Hi All,
let suppose i have json file like this
{
"url": "http://google.com",
"Viewmodel": {
"recipientId": 0,
"firstName": null,
"lastName": null
}
}
but above json structure changing every time so i can not create class
so for i have tried bellow
//get the Json filepath
string file = Server.MapPath("~/App_Data/output.json");
//deserialize JSON from file
string stringobj = System.IO.File.ReadAllText(file);
JavaScriptSerializer ser = new JavaScriptSerializer();
Object o= ser.Deserialize<Object>(stringobj);
foreach (var item in o)
{
// print the property but how ?
// print the value but how?
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
How to Validate Image Height and Width Using Javascript.
Installation of typescript