从WCF返回json对象 [英] Return json object from WCF

查看:75
本文介绍了从WCF返回json对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个叫"Device"的类,它的声明如下:

I have one class called "Device " and it declaration like as follow:

public class Device
    {
        public int DeviceID { set; get; }
        public string UserName { set; get; }

    }


我想创建一个WCF,该服务将在其中从JSON返回Device对象.
谁能告诉我该怎么做.而且我还想知道我将如何使用该WCF ... plz告诉我它的紧急情况


I want to create one WCF where this service will return Device object in from of JSON.
can anyone tell me how to do it. And i also would like to know how i will consume this WCF...plz tell me its urgent

推荐答案

请看下面的链接.

http://james.newtonking.com/pages/json-net.aspx [ ^ ]

http: //blogs.microsoft.co.il/blogs/pini_dayan/archive/2009/03/12/convert-objects-to-json-in-c-using-javascriptserializer.aspx [
Have a look at below links.

http://james.newtonking.com/pages/json-net.aspx[^]

http://blogs.microsoft.co.il/blogs/pini_dayan/archive/2009/03/12/convert-objects-to-json-in-c-using-javascriptserializer.aspx[^]


http://dotnetslackers.com/articles/ajax/JSON-EnabledWCFServicesInASPNET35.aspx [ ^ ]
WCF DataContracts中的JSON序列化和反序列化 [ http://www.pluralsight-training.net/community/博客/fritz/archive/2008/01/31/50121.aspx [ http://msdn.microsoft.com/en-us/library/dd203052.aspx [ ^ ]
http://dotnetninja.wordpress.com/2008/05/02/rest-service-with-wcf-and-json/[^]
http://dotnetslackers.com/articles/ajax/JSON-EnabledWCFServicesInASPNET35.aspx[^]
JSON serialization and de-serialization in WCF DataContracts[^]
http://www.pluralsight-training.net/community/blogs/fritz/archive/2008/01/31/50121.aspx[^]
http://msdn.microsoft.com/en-us/library/dd203052.aspx[^]


这篇关于从WCF返回json对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆