ASP.NET JSON Web服务为什么返回结果'D'? [英] Why do ASP.NET JSON web services return the result in 'd'?

查看:584
本文介绍了ASP.NET JSON Web服务为什么返回结果'D'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了使用JSON编码一些ASP.NET Web服务,一拉:

I wrote some ASP.NET web services that use JSON encoding, a la:

[WebInvoke()]
[OperationContract]
public int SetInformation(int recordid, string data)
{
    return 42;
}

和返回的JSON是:

{"d": 42}

为什么参数命名 D ?我可以控制吗?再说了,到电子

Why is the parameter named d? Can I control that? Say, to e?

有关参考,有几个类似的问题,我终于能够挖掘:

For reference, a few similar questions I've finally been able to dig up:

  • What does .d in JSON mean?
  • How to change ASP.NET WebMethod's 'd' identifier in a JSON response, to a different name?
  • Returning HTML from JSON webservice - what is the ".d" ?

推荐答案

这是一个安全的功能,$ P $从能够直接执行一个eval语句中的javascript返回pvents的JSON。或东西沿着这些路线非常相似。

This is a "security" feature that prevents the JSON from being returned from being able to be directly executed javascript inside an Eval statement. Or something very similar along these lines.

更多信息:<一href=\"http://encosia.com/a-breaking-change-between-versions-of-aspnet-ajax/\">http://encosia.com/a-breaking-change-between-versions-of-aspnet-ajax/看看标记服务员的部分,有一个在我的味精汤.D!

这篇关于ASP.NET JSON Web服务为什么返回结果'D'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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