943,692 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 1811
  • ASP.NET RSS
Jan 18th, 2008
0

JSON to class object

Expand Post »
Hi.

As suggested by ~s.o.s~ in another thread, I'm posting this question here in the high hopes that someone might be able to help me.

I have a JSON string coming in from a javascript that I need to convert to a predefined class object. I'd even settle for a struct.

The string in question may, or may not, contain an array of "objects". So that needs to be taken into consideration.

I've tried getting this to work with several methods by using different JSON libraries.
Two of the libraries are AjaxPro (which includes a JSON parser/serializer/deserialiser) and JayRock.

With JayRock I managed to import the JSON string into a variable of the datatype Object.
But I haven't worked much with that datatype so I'm having some trouble getting access to the data inside it.
During debugging I can see that it contains a JSONObject which in turn contains an ArrayList.

How do I convert this "object" into a workable .NET object so that I can access the data using properties?

I surely hope that anyone can understand my ranting and help/guide me with this problem.
Similar Threads
Reputation Points: 87
Solved Threads: 128
Practically a Master Poster
Oxiegen is offline Offline
652 posts
since Jun 2006
Jan 21st, 2008
0

Re: JSON to class object

Nevermind.
I solved the problem using a DataTable to send the information back and forth between client and server.
Reputation Points: 87
Solved Threads: 128
Practically a Master Poster
Oxiegen is offline Offline
652 posts
since Jun 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Hi Help me i am new to asp.net
Next Thread in ASP.NET Forum Timeline: text wrap around the image





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC