diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92d83cac6..bcddf844a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Remove `NoPartialFunctions` compiler workaround (#698) [@webwarrior-ws]
- Add `SLNX` and `SLNF` format support and migrate to SLNX solution #723 [@xperiandri]\
Remove `Ionide.ProjInfo.Sln` NuGet package dependency
+- Remove `Newtonsoft.Json` NuGet dependency #725 [@xperiandri]
## [0.24.2] - 2024-02-29
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 76426fc2c..9a5a76174 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -21,9 +21,9 @@
-
+
\ No newline at end of file
diff --git a/src/FSharpLint.Console/FSharpLint.Console.fsproj b/src/FSharpLint.Console/FSharpLint.Console.fsproj
index 5be5cdf16..a6f2c866d 100644
--- a/src/FSharpLint.Console/FSharpLint.Console.fsproj
+++ b/src/FSharpLint.Console/FSharpLint.Console.fsproj
@@ -29,7 +29,6 @@
-
diff --git a/src/FSharpLint.Core/Application/Configuration.fs b/src/FSharpLint.Core/Application/Configuration.fs
index 52d7098c3..e28b1b278 100644
--- a/src/FSharpLint.Core/Application/Configuration.fs
+++ b/src/FSharpLint.Core/Application/Configuration.fs
@@ -4,7 +4,8 @@ module FSharpLint.Framework.Configuration
open System
open System.IO
open System.Reflection
-open Newtonsoft.Json
+open System.Text.Json
+open System.Text.Json.Serialization
open FSharpLint.Framework
open FSharpLint.Framework.Rules
open FSharpLint.Framework.HintParser
@@ -15,40 +16,16 @@ let SettingsFileName = "fsharplint.json"
exception ConfigurationException of string
-module FSharpJsonConverter =
- open Microsoft.FSharp.Reflection
-
- type OptionConverter() =
- inherit JsonConverter()
-
- override x.CanConvert(t) =
- t.IsGenericType && t.GetGenericTypeDefinition() = typedefof<_ option>
-
- override x.WriteJson(writer, value, serializer) =
- let value =
- if isNull value then null
- else
- let _,fields = FSharpValue.GetUnionFields(value, value.GetType())
- fields.[0]
- serializer.Serialize(writer, value)
-
- override x.ReadJson(reader, t, _, serializer) =
- let innerType = t.GetGenericArguments().[0]
- let innerType =
- if innerType.IsValueType then (typedefof>).MakeGenericType([|innerType|])
- else innerType
- let value = serializer.Deserialize(reader, innerType)
- let cases = FSharpType.GetUnionCases(t)
- if isNull value then FSharpValue.MakeUnion(cases.[0], [||])
- else FSharpValue.MakeUnion(cases.[1], [|value|])
-
- let private converters =
- [|
- OptionConverter() :> JsonConverter
- |]
+module internal FSharpJsonConverter =
- let serializerSettings =
- JsonSerializerSettings(NullValueHandling = NullValueHandling.Ignore, Converters = converters)
+ let jsonOptions =
+ let options =
+ JsonSerializerOptions(
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
+ DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
+ )
+ options.Converters.Add(JsonStringEnumConverter())
+ options
module IgnoreFiles =
@@ -582,7 +559,7 @@ with
/// Tries to parse the provided config text.
let parseConfig (configText:string) =
try
- JsonConvert.DeserializeObject(configText, FSharpJsonConverter.serializerSettings)
+ JsonSerializer.Deserialize(configText, FSharpJsonConverter.jsonOptions)
with
| ex -> raise <| ConfigurationException $"Couldn't parse config, error=%s{ex.Message}"
diff --git a/src/FSharpLint.Core/FSharpLint.Core.fsproj b/src/FSharpLint.Core/FSharpLint.Core.fsproj
index f6dac62ba..c73bdac00 100644
--- a/src/FSharpLint.Core/FSharpLint.Core.fsproj
+++ b/src/FSharpLint.Core/FSharpLint.Core.fsproj
@@ -151,7 +151,6 @@
-