卸下" D"从ASP.Net Web服务的JSON输出对象 [英] Removing the "d" object from ASP.Net web service json output

查看:174
本文介绍了卸下" D"从ASP.Net Web服务的JSON输出对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些javascript code表示处理JSON输出从用框架2.0 asp.net web服务。现在我需要支持从Framework 3.5的Web服务返回的数据。

I have some javascript code that processes json output from asp.net web services built with framework 2.0. Now I need to support data returned from framework 3.5 web services.

我的JavaScript code假定对象为返回值,这在2.0正常工作清单。然而,在框架3.5,列表被包裹在一个D的对象。有没有什么办法可以去除D的包装,只是返回列表?

My javascript code assumes a list of objects as return value, which works fine in 2.0. However In framework 3.5, the list is wrapped in a "d" object. Is there any way I can remove the "d" wrapper and just return the list?

我会preFER来解决这个问题onthe服务器端

I would prefer to fix this onthe server side

推荐答案

您不能配置3.5+服务不回 .D 。这是很好的,它的存在也是如此,因为它存在时,外JSON实体是一个数组一个棘手的JSON劫持场景保护。

You can't configure 3.5+ services not to return the .d. It's good that it's there too, because it protects from a tricky JSON hijacking scenario that exists when the outer JSON entity is an array.

ASP.NET AJAX的客户端代理自动隐藏 .D 你。如果它在你的方式,我假设你正在使用像jQuery来调用服务? 您可以正常化 .D jQuery中使用其DataFilter回调,例如。

ASP.NET AJAX's client-side proxies automatically hide the .d from you. If it's getting in your way, I'm assuming you're using something like jQuery to call the service? You can normalize the .d in jQuery by using its DataFilter callback, for example.

这篇关于卸下" D"从ASP.Net Web服务的JSON输出对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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