PDA

View Full Version : [CLOSED] Specify how object is serialized in DirectMethod



jchau
Jan 12, 2013, 8:14 PM
I have a directmethod that returns an object. Is it possible to make the serialization use the CamelCasePropertyNamesContractResolver? The object has property called Name but I need it to be "name" once serialized. If I return a string and encode back on clientside, I can make it work but just wondering if there's a better way.



JSON.Serialize(someObject, New Newtonsoft.Json.Serialization.CamelCasePropertyNam esContractResolver()

Vladimir
Jan 12, 2013, 8:18 PM
You can serialize value manually to string as required, wrap by JRawValue and return in direct method


return JRawValue.From(json_string);