简体   繁体   中英

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

I've done a project in ASP.NET with C#. Now I need to write 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/ .

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