FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister  MasterVB.NET
Visual Basic 2005 .NET Forum
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Serialize/Deserialize
 
Post new topic   Reply to topic    MasterVB.NET Forum Index -> Web Forms
View previous topic :: View next topic  
Message
Author
MatthewRaymer
Newbie
Joined: 11 Jul 2006
Posts: 8

PostPosted: Fri Jul 21, 2006 4:00 am    
Post subject: Serialize/Deserialize
Reply with quote
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/



 

Back to top
View user's profile Send private message
Author
MichaelSchwarz
Intermediate
Joined: 11 Jul 2006
Posts: 252

PostPosted: Fri Jul 21, 2006 4:00 am    
Post subject:
Reply with quote

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:


[AjaxPro.AjaxMethod]
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:
Quote:
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


 

Back to top
View user's profile Send private message
Author
MatthewRaymer
Newbie
Joined: 11 Jul 2006
Posts: 8

PostPosted: Sat Jul 22, 2006 4:00 am    
Post subject:
Reply with quote
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:
Quote:


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:


[AjaxPro.AjaxMethod]
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/



 

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    MasterVB.NET Forum Index -> Web Forms All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Archieve

Powered by phpBB © 2001, 2002 phpBB Group, used in Visual Basic 2005 .NET Forum

| Visual Basic .NET Forum | Online Recipe Archiver | Shareware Freeware PAD | Lowongan Kerja | Kamus Online | Health Supply | Digital Camera Review |
Orang Paling Keren

RSS