Reputation: 767
i have a webservice (wsdl) generated from a java project. its output is getting as json format.
something like this
[{"pid":163686,"chartno":null,"lName":"Bec&&kwith","fName":"Burt","mName":null,"line1":"312 HILL ROAD","line2":null,"city":"Hillsboro","state":"Missouri","pinCode":null,"phone":"123456879","dob":"1947-01-01","gender":"Male","ssn":null,"martialStatus":null,"guarantor":null,"sig":null,"priInsname":null,"priPolNo":null,"secInsname":null,"secPolNo":null}]
i want to use this data in my c# web application to display it in a grid.. how can i get this data into a datatable? how to format the json output to a table structure if multiple data comes?
The heading will be pid, chartno, ... etc .
i dont want to make it too complex... i just want the json output to store into a dictnory or somthing .. thank u
Upvotes: 0
Views: 1344
Reputation: 39268
I would deserialize the JSON in to a custom c# object instead of a DataTable.
Deserialize JSON string to c# object
Essentially you can use the JavaScript serializer to deserialize your JSON string into the object. I recommend this over the data table since you would have to manually map it to the table The grid should be able to consume a List of your custom object instead of a data table
Upvotes: 1