|
Serialize/Deserialize -- MatthewRaymer --
Michael, Why does the following not work on the new DLL? JavaScriptArray jso = new JavaScriptArray(); JavaScriptArray jso1 = new JavaScriptArray(); JavaScriptArray jso2 = new JavaScriptArray(); JavaScriptString jss = new JavaScriptString("000000000001"); jso1.Add(jss); jso2.Add(jss); jso.Add(jso1); jso.Add(jso2); string json = AjaxPro.JavaScriptSerializer.Serialize(jso); Object o = AjaxPro.JavaScriptDeserializer.DeserializeFromJson(json, jso.GetType()); Matthew -- OpenSubject: for efficient mail ---------------------------------------------- NRN: No Reply Necessary RYN: Reply with 'Yes' or 'No' AYQ: Answering Your question ATC: Attachement is important 1QM: One Question Message MQM: Multiple Question Message FYA: For your Archive FYI: For your information (NRN) WFR: Waiting for your Reply/Advice/Permission AET: Answer Expected Today/this Week/within a Month RAF: Read and Forward (jokes, quotes, interesting) ---------------------------------------------- More information: http://opensubject.pbwiki.com / |
|
-- MichaelSchwarz --
Hi Matthew, please download the current version 6.7.20.1 or higher from http://www.ajaxpro.info /. I have done following example which is working correct, now:public static string Test(string h) { JavaScriptArray jso = new JavaScriptArray(); JavaScriptArray jso1 = new JavaScriptArray(); JavaScriptArray jso2 = new JavaScriptArray(); JavaScriptString jss = new JavaScriptString("000000000001"); jso1.Add(jss); jso2.Add(jss); jso.Add(jso1); jso.Add(jso2); string json = AjaxPro.JavaScriptSerializer.Serialize(jso); JavaScriptArray a = (JavaScriptArray)JavaScriptDeserializer.DeserializeFromJson(json, typeof(JavaScriptArray)); string json2 = AjaxPro.JavaScriptSerializer.Serialize(a); return (json == json2).ToString(); // this will return "True" } Regards, Michael On 7/20/06, Matthew Raymer <matthew.raymer> wrote: Michael, Why does the following not work on the new DLL? JavaScriptArray jso = new JavaScriptArray(); JavaScriptArray jso1 = new JavaScriptArray(); JavaScriptArray jso2 = new JavaScriptArray(); JavaScriptString jss = new JavaScriptString("000000000001"); jso1.Add(jss); jso2.Add(jss); jso.Add(jso1); jso.Add(jso2); string json = AjaxPro.JavaScriptSerializer.Serialize(jso); Object o = AjaxPro.JavaScriptDeserializer.DeserializeFromJson(json, jso.GetType()); Matthew -- OpenSubject: for efficient mail ---------------------------------------------- NRN: No Reply Necessary RYN: Reply with 'Yes' or 'No' AYQ: Answering Your question ATC: Attachement is important 1QM: One Question Message MQM: Multiple Question Message FYA: For your Archive FYI: For your information (NRN) WFR: Waiting for your Reply/Advice/Permission AET: Answer Expected Today/this Week/within a Month RAF: Read and Forward (jokes, quotes, interesting) ---------------------------------------------- More information: http://opensubject.pbwiki.com /> -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz /http://www.schwarz-interactive.de /Skype: callto:schwarz-interactive MSN IM: passport |
|
-- MatthewRaymer --
Michael, Thanks! We'll start porting our methods to JavaScriptArray and JavaScriptObject today. Maybe that will be enough diversity to test the new deserialization. Matthew On 7/20/06, Michael Schwarz <michael.schwarz> wrote: Hi Matthew, please download the current version 6.7.20.1 or higher from http://www.ajaxpro.info /. I have done following example which isworking correct, now: public static string Test(string h) { JavaScriptArray jso = new JavaScriptArray(); JavaScriptArray jso1 = new JavaScriptArray(); JavaScriptArray jso2 = new JavaScriptArray(); JavaScriptString jss = new JavaScriptString("000000000001"); jso1.Add(jss); jso2.Add(jss); jso.Add(jso1); jso.Add(jso2); string json = AjaxPro.JavaScriptSerializer.Serialize(jso); JavaScriptArray a = (JavaScriptArray)JavaScriptDeserializer.DeserializeFromJson(json, typeof(JavaScriptArray)); string json2 = AjaxPro.JavaScriptSerializer.Serialize(a); return (json == json2).ToString(); // this will return "True" } Regards, Michael On 7/20/06, Matthew Raymer <matthew.raymer> wrote: > Michael, > > Why does the following not work on the new DLL? > > JavaScriptArray jso = new JavaScriptArray(); > JavaScriptArray jso1 = new JavaScriptArray(); > JavaScriptArray jso2 = new JavaScriptArray(); > JavaScriptString jss = new > JavaScriptString("000000000001"); > jso1.Add(jss); > jso2.Add(jss); > jso.Add(jso1); > jso.Add(jso2); > > string json = > AjaxPro.JavaScriptSerializer.Serialize(jso); > Object o = > AjaxPro.JavaScriptDeserializer.DeserializeFromJson(json, > jso.GetType()); > > Matthew > > -- > OpenSubject: for efficient mail > ---------------------------------------------- > NRN: No Reply Necessary > RYN: Reply with 'Yes' or 'No' > AYQ: Answering Your question > ATC: Attachement is important > 1QM: One Question Message > MQM: Multiple Question Message > FYA: For your Archive > FYI: For your information (NRN) > WFR: Waiting for your Reply/Advice/Permission > AET: Answer Expected Today/this Week/within a Month > RAF: Read and Forward (jokes, quotes, interesting) > ---------------------------------------------- > More information: http://opensubject.pbwiki.com /> > > > > > > -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz /http://www.schwarz-interactive.de /Skype: callto:schwarz-interactive MSN IM: passport > -- OpenSubject: for efficient mail ---------------------------------------------- NRN: No Reply Necessary RYN: Reply with 'Yes' or 'No' AYQ: Answering Your question ATC: Attachement is important 1QM: One Question Message MQM: Multiple Question Message FYA: For your Archive FYI: For your information (NRN) WFR: Waiting for your Reply/Advice/Permission AET: Answer Expected Today/this Week/within a Month RAF: Read and Forward (jokes, quotes, interesting) ---------------------------------------------- More information: http://opensubject.pbwiki.com / |