From a506d91314f2972af44ab062dcb4b426bac06818 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Fri, 8 Mar 2024 10:49:46 -0800 Subject: [PATCH] Remove explicit Newtonsoft.Json package reference (#1799) --- Directory.Packages.props | 1 - Jint.Benchmark/Jint.Benchmark.csproj | 1 - Jint.Benchmark/UncacheableExpressionsBenchmark.cs | 14 +++++--------- .../Jint.Tests.PublicInterface.csproj | 1 - Jint.Tests/Jint.Tests.csproj | 1 - 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 762f508a35..ac06b5d118 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,7 +15,6 @@ - diff --git a/Jint.Benchmark/Jint.Benchmark.csproj b/Jint.Benchmark/Jint.Benchmark.csproj index 86d17a424f..d1675bf7b7 100644 --- a/Jint.Benchmark/Jint.Benchmark.csproj +++ b/Jint.Benchmark/Jint.Benchmark.csproj @@ -26,7 +26,6 @@ - diff --git a/Jint.Benchmark/UncacheableExpressionsBenchmark.cs b/Jint.Benchmark/UncacheableExpressionsBenchmark.cs index 7ecf3d898e..3031fc7781 100644 --- a/Jint.Benchmark/UncacheableExpressionsBenchmark.cs +++ b/Jint.Benchmark/UncacheableExpressionsBenchmark.cs @@ -1,7 +1,7 @@ using System.Text; +using System.Text.Json; using BenchmarkDotNet.Attributes; using Jint.Native; -using Newtonsoft.Json; namespace Jint.Benchmark; @@ -64,14 +64,10 @@ public void Setup() using (var stream = new MemoryStream()) { - using (var writer = new StreamWriter(stream)) - { - JsonSerializer.CreateDefault().Serialize(writer, doc); - writer.Flush(); + JsonSerializer.Serialize(stream, doc); - var targetObjectJson = Encoding.UTF8.GetString(stream.ToArray()); - targetObject = $"var d = {targetObjectJson};"; - } + var targetObjectJson = Encoding.UTF8.GetString(stream.ToArray()); + targetObject = $"var d = {targetObjectJson};"; } CreateEngine(Arrow ? ArrowFunctionScript : NonArrowFunctionScript); @@ -107,6 +103,6 @@ private void CreateEngine(string script) engine = new Engine(InitializeEngine); engine.Execute(script); engine.Execute(targetObject); - targetJsObject = new[] {engine.GetValue("d")}; + targetJsObject = new[] { engine.GetValue("d") }; } } diff --git a/Jint.Tests.PublicInterface/Jint.Tests.PublicInterface.csproj b/Jint.Tests.PublicInterface/Jint.Tests.PublicInterface.csproj index 031c29e384..c9a9500625 100644 --- a/Jint.Tests.PublicInterface/Jint.Tests.PublicInterface.csproj +++ b/Jint.Tests.PublicInterface/Jint.Tests.PublicInterface.csproj @@ -25,7 +25,6 @@ - diff --git a/Jint.Tests/Jint.Tests.csproj b/Jint.Tests/Jint.Tests.csproj index b6645c69f0..dabcad2e45 100644 --- a/Jint.Tests/Jint.Tests.csproj +++ b/Jint.Tests/Jint.Tests.csproj @@ -29,7 +29,6 @@ -