I am truly stumped here. Here is my JSON returned:
{"ResponseData":[{"ClusterID":"c02f1f5c-c61b-4f2c-ab5a-249966b3cdef","ClusterName":"Northeast","Courses":[{"CourseID":"8ab4f2b3-8160-4d7e-b79f-8d8b58926cc0","CourseName":"Home Course","SubCourses":[{"SubCourseName":"SubCourse1","SubCourseNumber":18}]},{"CourseID":"b3223464-333b-4c54-89c2-23908e0510c9","CourseName":"Away Course","SubCourses":[{"SubCourseName":"SubCourse1","SubCourseNumber":19}]}],"IsHomeCluster":true},"ResponseErrors":[]}
This is my code to deserialize:
JArray jArr = (JArray)JsonConvert.DeserializeObject(json);
foreach (var item in jArr) {
foreach (var subitem in item["ResponseData"]) {
Console.WriteLine (subitem ["ClusterID"]);
}
}
Project compiles fine, but when I run it in the simulator, I get this error:
System.TypeLoadException: A type load exception has occurred. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, Boolean checkAdditionalContent) [0x00000] in :0 at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in :0 at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in :0 at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in :0 at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value) [0x00000] in :0 at AppMultiView.CourseInformationScreen.ViewDidLoad () [0x00029] in /Users/Dan/Desktop/AppTouch_dev /Screens/CourseInformationScreen.cs:48 at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend_IntPtr_bool (intptr,intptr,intptr,bool) at MonoTouch.UIKit.UINavigationController.PushViewController (MonoTouch.UIKit.UIViewController viewController, Boolean animated) [0x00021] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UINavigationController.g.cs:176 at AppMultiView.HomeScreen.m__2 (System.Object sender, System.EventArgs e) [0x00016] in /Users/Dan/Desktop/AppTouch_dev /Screens/HomeScreen.cs:75 at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:30 at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at AppMultiView.Application.Main (System.String[] args) [0x00000] in /Users/Dan/Desktop/AppTouch_dev /Main.cs:18
Am I trying to deserialize the wrong thing?
Any pointers will be greatly appreciated.