Solved

JSON Deserialization

Posted on 2013-05-24
3
370 Views
Last Modified: 2013-05-24
I have a complex user defined class that contains strings, and int, but also contains other class types, and lists of classes. A simple example is below:

public class Data
{
      public Int32 Id { get; set; }
      public String Name { get; set; }
      public List<Items> Items { get; set; }
}

public class Item
{
      public Int32 Id { get; set; }
      public String Name { get; set; }
}

Open in new window




I have managed to serialize an instance of this class using SimpleJSON.

The problem I have is de-serializing it back to an instance of the original strongly typed class.  

I have spent hours search the web, but cannot find any simple definitive answer.
0
Comment
Question by:townsma
3 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 500 total points
ID: 39193682
Have you tried Json.Net? It's very easy to serialize/deserialize objects with this library, even if your objects contains complex properties.

http://james.newtonking.com/projects/json-net.aspx

Hope that helps.
0
 
LVL 6

Expert Comment

by:worm-getter
ID: 39193765
0
 
LVL 6

Author Closing Comment

by:townsma
ID: 39193784
Thanks, just what I was looking for.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate jars 4 28
application restarter  - for an exe that hangs 9 25
pagenation logic how it is working in my code 1 27
sql import cannot be resolved jsp 3 19
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question