views:

35

answers:

1

Hi all,

I created a REST GetTime Service in WCF and the service returns JSON as the response message. Also the WebMessageBodyStyle is set to wrapped so it would have an ID associated with that data it returns. But when I use Fiddler to test my service the response string is:

{"GetTimeResult":"2010614104013"}

As the response above the ID of the string is GetTimeResult, I'm wondering is there any way on changing that bit of test to timestamp. So it looks like this:

{"timestamp":"2010614104013"}

Cheers.

A: 

If you are using the DataContract/DataMember attributes in your code, you add a name (as well as some other named parameters).

[DataMember(Name = "timestamp")]
public string GetTimeResult
smencer