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/.
精彩评论