All Im trying to do is null out property based on an attribute.
How to use newtonsoft instead of system.text.json. At this point blocked by https. I have used JObject extensively which is the wrong name for any class. SystemTextJson provides two ways to build a JSON DOM.
The CosmosDBAsyncCollector output binding uses Newtonsoft as its JSON Serializer. To use a custom JSON property naming policy create a class that derives from JsonNamingPolicy and override the ConvertName method as shown in the following example. Start by backing up the projects removing the NewtonsoftJson package reference from them and replacing either or both of these two lines.
Namespace SystemTextJsonSamples public class UpperCaseNamingPolicy. Should it only affect target netcoreapp30. JsonNamingPolicy public override string ConvertNamestring name nameToUpper.
This article shows how to use the SystemTextJson namespace to serialize to and deserialize from JavaScript Object Notation JSON. JsonDocument provides the ability to build a read-only DOM by using Utf8JsonReader. I have used NewtonsoftJson for converting JSON object to string and vice versa.
For Azure Functions on runtime version 3 targetingNET Core 31 it would be preferred if all of the bindings directly supported SystemTextJson preferably by default. All of the methods to write the property to output are by type ie. If you use JsonSerializerOptions repeatedly with the same options dont create a new JsonSerializerOptions instance each time you use it.
You can almost accomplish this in SystemTextJson with a custom JsonConverter. After recently upgrading this project to dotnetcore 5 which was much easier than the linked upgrade to dotnetcore 3 I was curious to see what the migration path looked like for a real project. Adoption of SystemTextJson is encouraged for applications targetingNET Core 3.