Reputation: 5223
I am adding a document to Cosmos DB with following line:
client.CreateDocumentAsync(collectionLink, report).Wait();
My c# classes are uppercase however standard json you lowercase properties. Is it possible somehow to ensure this when saving the document?
Upvotes: 1
Views: 1447
Reputation: 7200
Some of the DocumentClient
constructors accept an object called JsonSerializerSettings
.
You can provide a different contract resolver there. In your case it's the CamelCasePropertyNamesContractResolver
.
var client = new DocumentClient(new Uri(""), "", serializerSettings: new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
Upvotes: 3