tags:

views:

32

answers:

2

I have looked through lots of Posts and have not been successful in determining how to get rid of the pesky d in the response coming from my asmx web service, as in {"d":{"Response":"OK","Auth-Key":"JKPYZFZU"}}.

This is being created by my class 'public Dictionary UserDevice' by returning the Dictionary object.

I would be perfectly happy if the damn thing just wouldn't put it all into the d object!

+1  A: 

You are probably using some kind of framework that automatically wraps your web service json responses with the d element.

I know that microsoft's JSON serializer adds the d on the server side, and the client-side AJAX code that deserializes the JSON string expects it to be there.
I think jQuery works this way too.

You can read a little more about this at Rick Strahl's blog

And there is a way for you to return pure json (without the 'd' element) using the WCF "Raw" programming model.

gillyb
PIA, but I'll have to go this route!
Steve Reed Sr
I feel kinda stupid asking this here, but what is 'PIA' stand for ? :)
gillyb
Pain in the ass! Sometimes referred to as PITA.
Steve Reed Sr
+1  A: 

You can read about why it's there here:

http://encosia.com/2009/02/10/a-breaking-change-between-versions-of-aspnet-ajax/

Radu
Thank you for your timely response! Don't know why I didn't find that article.Unfortunately I'm communicating with a device that is not a browser so is not vulnerable to attacks. Too bad Microsoft didn't give us an easy way around their 'helpful' solution.
Steve Reed Sr