我是WCF的新手。我创建了一个WCF服务,并将数据作为JSON数据返回。我将返回数据分配给GridView,它完美地显示了数据。如何在C#中显示JSON数据
[OperationContract]
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate="employee/{search}")]
List<Employee> Listing(string search);
现在,我想在<的div元素>(验证数据)显示JSON字符串。我试图表明返回的数据,
dvJson.InnerHtml = esc.Listing("s");
它显示像使用C#DIV元素此
Employee[]
如何显示JSON字符串?
在此先感谢。
它显示输出:[{ “__type”: “雇员:#Org”, “ID”:1, “名称”: “拉加”},{ “__类型”: “雇员:#Org”, “ID”:2 “名称”: “MANISHA”}]。我们可以通过'__type'来获取数据:“Employee:#Org”'? – Jesuraja
n您的web.config:而不是' '元素使用' '为您的'endpointBehaviors',例如: ' endpointBehaviors> <行为名称= “MyServiceEndpoint”> endpointBehaviors>' –
http://stackoverflow.com/questions/627356/how-to-not-serialize-the-type-property-on- JSON对象 –