By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

Convert Class Object to JSON string?

P: n/a
Im using C#, ASP.NET v1.1. My class contains intrinsic types,
ArrayList, and XmlDocument types. Some variables have the value NULL.

After usng XmlSerializer and the information on:
http://www.phdcc.com/xml2json.htm I'm having issue fully converitng my
class object to a javascript readable string.

The XmlSerializer appears to ignore all variables containing NULL and
so the final JSON output is incomplete. Also I have a DateTime object
within my class. The converted date is horrible, certainly not even
close to what Javascript can parse. Is there a way to set the datetime
format.

Is there anything i can do to resolve this or a better tool for
converting my class object to JSON string?

Jan 15 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Are you specifiying the xml serialisation attribute 'IsNullable = true', see

http://msdn2.microsoft.com/en-us/lib...te(VS.80).aspx

also you specify the date format using the XSD type:

http://msdn.microsoft.com/library/de...eworktypes.asp

and xml convert class:

http://msdn.microsoft.com/library/de...classtopic.asp
HTH

Ollie Riches

"quantass" <qu******@gmail.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
Im using C#, ASP.NET v1.1. My class contains intrinsic types,
ArrayList, and XmlDocument types. Some variables have the value NULL.

After usng XmlSerializer and the information on:
http://www.phdcc.com/xml2json.htm I'm having issue fully converitng my
class object to a javascript readable string.

The XmlSerializer appears to ignore all variables containing NULL and
so the final JSON output is incomplete. Also I have a DateTime object
within my class. The converted date is horrible, certainly not even
close to what Javascript can parse. Is there a way to set the datetime
format.

Is there anything i can do to resolve this or a better tool for
converting my class object to JSON string?

Jan 16 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.