I'm consuming a web service that returns json, and storing the json in a local variable. The json represents a simple business object such as:
var entry = {
FirstName: John,
LastName: Doe,
....
};
The casing is like that because it matches up with the property names from the .net class, as per our naming convention.
When a change a few of these properties and pass back the json, the web service now expects camel case (again, as per our naming convention for method parameters) instead of the pascal case initially returned.
var entry = {
firstName: John,
lastName: Doe,
....
};
This of course doesn't work.
I'm using JSON.stringify
to send the json back to the web service as a string, and I was looking to see if there was an easy way to change the key to camel case. However, it looks like I can only use the replacer param to work with the value.
I could change the serialization of the class, but lets pretend that's not an option. Any ideas?
Thanks.