Created
April 13, 2012 15:11
-
-
Save ryanewtaylor/2377563 to your computer and use it in GitHub Desktop.
JSON serialization filter to remove the .d from ASP.NET JSON web services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import com.adobe.serialization.json.JSON; | |
import mx.rpc.http.AbstractOperation; | |
import mx.rpc.http.SerializationFilter; | |
public class JSONSerializationFilter extends SerializationFilter | |
{ | |
public static const RESULT_FORMAT_JSON:String = "json"; | |
public function JSONSerializationFilter() | |
{ | |
super(); | |
} | |
override public function deserializeResult(operation:AbstractOperation, result:Object):Object | |
{ | |
var o:Object = JSON.decode(String(result)); | |
if (o.hasOwnProperty("d")) | |
{ | |
return o.d; | |
} | |
return o.d; | |
} | |
} | |
} |
@bartelink He's doing it client side in a language where JS inst in play - spend a few more seconds scanning will ya!
Where I have to put it?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why? (i.e. no harm to explain reason given http://stackoverflow.com/questions/2811525/removing-the-d-object-from-asp-net-web-service-json-output)