c# - Converting JSON object to dynamic object -
I need to get the value of my JSON object at the back end using C # I JSON object is as follows : "StudentName": "Michael Lumb", "Topicode": ["1", "2"], "Grade": "3"}
I have tried that this code is:
public string addStudent {jobbaked student data} {dynamic dObject = Jobbject.Parse (studentData.ToString ()); String _studentName = dObject.StudentName; // fine string [] _subjectCodes = dObject.SubjectCodes; // returns error 'indirectly can not change type ....'} I need to get the "theme code" in the form of a string array How do I get it?
install newtonsoft:
install-package Json: < / P> string json = "{'studentname': 'Michael Lambs', 'themecode': ['1', '2'], 'grade': '3'}"; Student student = JsonConvert.DeserializeObject & lt; Students & gt; (JSN); Change to json:
string json = JsonConvert.Serialize (student);
Comments
Post a Comment