简体   繁体   中英

How to get json output from a webservice as a datatable in c#?

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

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

你需要解析json,你可以用JQuery来解析json对象。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM