Removing object "d" from ASP.Net web service for json output

I have javascript code that handles json output from asp.net web services built using the 2.0 framework. Now I need to support data returned from Framework 3.5 Web Services.

My javascript code assumes a list of objects as a return value, which works fine in version 2.0. However, within 3.5, the list is placed in the "d" object. Is there a way to remove the d shell and just return the list?

I would rather fix this on the server side

+5
json javascript
May 11, '10 at 14:27
source share
2 answers

You cannot configure 3.5+ services not to return .d . It's good that it is there too, because it protects against the complex JSON capture script that exists when the external JSON object is an array.

Client-side ASP.NET AJAX .d automatically hide .d from you. If this is in your way, I assume you are using something like jQuery to call the service? You can normalize .d in jQuery using a DataFilter callback , for example.

+5
May 11 '10 at 16:46
source share

Well, if you have the advantage of change on the client side, the best way is to use jquery and you will find a ton of solutions. But if you want to remove the "d" at the service level, the best way is to rewrite your web service in Web Api (you can also use WCF). Web Api does not return "d" in response.

0
Feb 11 '16 at 7:13
source share



All Articles