Click here to Skip to main content
15,904,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
suupose i have json string like this:
{employee details:[{"name":"ram","eid":12345,"desgination":"softwareenginnerr"},{"name":"sita","eid":65437,"desgination":"hardwareeenginnerr"},{"name":"raghu","eid":98765,"desgination":"testingenginnerr"}]}

i want display all the fields with values in textboxes or wat ever it is..
i used keyvalue pair but its not getting..
if any body knoes pls let me know..
Posted
Updated 27-Jul-11 20:53pm
v2

1 solution

Do you only want to deserialize JSON data or you need to serialize and deserialize data by yourself? If so, you don't need to do anything manually. Instead, use Data Contract with System.Runtime.Serialization.Json.DataContractJsonSerializer.

See:
http://msdn.microsoft.com/en-us/library/ms733127.aspx[^],
http://msdn.microsoft.com/en-us/library/bb412179.aspx[^]
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx[^].

Please also see my past solution where I advocate this robust and easy-to-use approach:
How can I utilize XML File streamwriter and reader in my form application?[^],
Creating a property files...[^].

I explain things using System.Runtime.Serialization.Json.DataContractSerializer (http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer.aspx[^]), but this is applicable to System.Runtime.Serialization.Json.DataContractJsonSerializer as well.

—SA
 
Share this answer
 
Comments
komalilella 28-Jul-11 1:49am    
i want to deseralize using key value pair ..pls let me know..
Sergey Alexandrovich Kryukov 1-Aug-11 0:53am    
I gave you a general solution. There is no "deserialize" if one does not know how data is serialized. With Data Contract, you don't care about the detail; your whole object graphs is stored and restored.
--SA
RaisKazi 28-Jul-11 3:13am    
komalilella,

You have three fields. How can you have "key value pair" from three fields?

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