User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 425,956 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,654 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 700 | Replies: 1 | Solved
Reply
Join Date: Jun 2006
Location: Sweden
Posts: 45
Reputation: Oxiegen is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 2
Oxiegen Oxiegen is offline Offline
Light Poster

JSON to class object

  #1  
Jan 18th, 2008
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: Sweden
Posts: 45
Reputation: Oxiegen is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 2
Oxiegen Oxiegen is offline Offline
Light Poster

Re: JSON to class object

  #2  
Jan 21st, 2008
Nevermind.
I solved the problem using a DataTable to send the information back and forth between client and server.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 10:33 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC