Convert JSON to XML - C# Routine?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Convert JSON to XML - C# Routine?

  1. #1
    Join Date
    Mar 2004
    Posts
    9

    Convert JSON to XML - C# Routine?

    Can someone please provide me C# code on converting JSON to XML. I'm looking to convert somehting like:

    {Test:{a:1,b:2,c:{x=3},d:4}}

    to

    <test a="1" b="2" d="4">
    <c x="3" />
    </test>

    I'm using .NET Framework v1.1 so the Ajax extensions for ASP.NET are no good to me.

    Thanks.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    In your situation, I would probably use something like Json.NET to deserialize the JSON, then use .NET's standard XmlSerializer to serialize to XML.
    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
    Mar 2004
    Posts
    9
    Hi Phil. Thanks for the info. The only problem i have with Json.net is it is using .NET Framework 2.0. Im using 1.1 within VS .NET 2003. My assembly refuses to reference its DLL. ****.


    Any alternatives?

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Json.NET is open source, right? Couldn't you download the source and and back-port it to .NET 1.1?
    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!

  5. #5
    Join Date
    Mar 2004
    Posts
    9
    That would be a good idea but thats the problem. The source is geared towards 2.0 and 2.0 assembly references. Unfortunately my knowledge of 2.0 to 1.1 mapping isnt that extensive.

Similar Threads

  1. Try XML Junction
    By Tim in forum xml.announcements
    Replies: 0
    Last Post: 10-11-2001, 04:00 PM
  2. XML Startkabel Updates
    By xmlstartkabel in forum XML
    Replies: 0
    Last Post: 10-10-2001, 04:07 AM
  3. Data Junction Announces XML Junction 7.51
    By Tim Frost in forum xml.announcements
    Replies: 0
    Last Post: 04-02-2001, 10:53 AM
  4. Check out Turbo XML: Free trial download
    By Extensibility in forum web.announcements
    Replies: 0
    Last Post: 07-20-2000, 06:20 PM
  5. Check out Turbo XML
    By Sales in forum xml.announcements
    Replies: 0
    Last Post: 07-20-2000, 06:18 PM

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