How do I replace NewtonSoft.Json with System.Text.
1 min
Activate recommends migrating from Newtonsoft.Json to System.Text.Json when upgrading to V8. This article will detail how to convert scripts.
- Replace import of Newtonsoft.Json with System.Text.Json
- Remove using Newtonsoft.Json and other namespaces.
- Add the following using statements at the top of your script
- using System.Text.Json;
- using System.Text.Json.Nodes;
- using System.Text.Json.Serialization;
- Make the following class replacements:
- JObject with JsonObject
- JArray with JsonArray
- JToken with JsonNode
- JsonConvert.SerializeObject with JsonSerializer.Serialize