Convert Class Object to JSON string?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Convert Class Object to JSON string?

  1. #1
    Join Date
    Mar 2004
    Posts
    9

    Convert Class Object to JSON string?

    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?

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    It looks like Microsoft's ASP.NET (2.0) AJAX Extensions support XML-to-JSON serialization. With ASP.NET 1.1, you may need to create a custom serializer to get the behavior you desire. For more information on custom serialization, see http://www.15seconds.com/issue/020903.htm
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jun 2012
    Posts
    1

Similar Threads

  1. JDOM Classpath Help Required
    By kpandya in forum Java
    Replies: 5
    Last Post: 01-15-2006, 07:10 PM
  2. Object Array ? Do you Worth it
    By ashish in forum Java
    Replies: 1
    Last Post: 05-23-2002, 07:50 AM
  3. Replies: 1
    Last Post: 06-05-2001, 06:12 AM
  4. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 2
    Last Post: 08-11-2000, 12:11 PM
  5. Replies: 0
    Last Post: 06-22-2000, 07:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center