Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm developing my first client server android application. The client i.e, the android application gives request to find out the no of products submitted by the client in the server database. The server is sending the following data as string to the android application.

//server sending the response to client in this form.

{productid:1, productname:Google Nexus 5, productdescription:New Mobile Phone, productimage:Nexus 5.jpg, biddate:14-Feb-14 7:30:00 PM, currentdate:14-Feb-14 11:57:41 AM, productrate:33500}{productid:5, productname:Samsung Galaxy Ace, productdescription:Used Mobile Phone, productimage:Ace.jpg, biddate:15-Feb-14 7:30:00 PM, currentdate:14-Feb-14 11:57:41 AM, productrate:8500}

The above code is the output when the server sends the details of 2 products. I need to separate all the details as below and display as a list view. If there are n products as the response from the server, then there would be n items in the list view. I know the working of list view and its coding. But I don't know how to process this server response.

productid[0]=1
productname[0]=Google Nexus 5
productdescription[0]=New Mobile Phone //this should be first item in the list
productimagename[0]=Nexus 5.jpg
biddate[0]=14-Feb-14 7:30:00 PM
currentdate[0]=14-Feb-14 11:57:41 AM
productrate[0]=33500

//similarly
productid[1]=5 //this is the second item to be displayed in the list view
productname[1]=Samsung Galaxy Ace
productdescription[1]=Used Mobile Phone
productimagename[1]=Ace.jpg
biddate[1]=15-Feb-14 7:30:00 PM
currentdate[1]=14-Feb-14 11:57:41 AM
productrate[1]=8500
I have heard that this can be accomplished by using json deserializing. But I don't know how to do it. Can any one please help me out..
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900