Control the Formatting of JsonValue.ToString()

Topics: Web Api
Mar 1, 2012 at 5:16 PM
Edited Mar 1, 2012 at 5:19 PM

I need to serialize a request data structure. Currently, I use


            var value = JsonValueExtensions.CreateFrom(request);
            var json = value.ToString();
            HttpContent content = new StringContent(json);

I created my request object as any other POCO type, with the usual naming conventions. However, I need to serialize 'MerchantEmail' as 'merchantEmail'. Is there any way to manage this? How shall I go about doing this short of renaming the properties in my types? Thanks!

Furthermore, I'm going to need to deserialize the response as well from camelCase to PascalCase. How would I do that?