开发者

how to parse and identify header from JSON Data in WCf Service at server side

开发者 https://www.devze.com 2023-03-07 04:57 出处:网络
I\'ve done a project in ASP.NET with C#. Now I need to writ开发者_如何转开发e a WCF service for this. On the server-side, how can I parse JSON data, and how can I identify the header, body, footer, et

I've done a project in ASP.NET with C#. Now I need to writ开发者_如何转开发e a WCF service for this. On the server-side, how can I parse JSON data, and how can I identify the header, body, footer, etc.?


You would normally define a data contract which maps to your JSON structure. You'd then write a service contract which would accept the data contract type in your operation, and WCF does the parsing of the JSON data into the type.

I've written a small tool that helps you do that, you can find a link to it in the blog post at http://blogs.msdn.com/b/carlosfigueira/archive/2011/01/11/inferring-schemas-for-json.aspx.


An easy way to parse and/or generate JSON data is JSON.NET. It's a great library and much better than the built-in JSON serializer.

You can find it at http://json.codeplex.com/.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号