Skip to content

Commit fb14fe8

Browse files
committed
chore(deps): replace Newtonsoft with System.Text.Json
1 parent b93e89f commit fb14fe8

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

src/ConsumerApiClient.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Net.Http;
43
using System.Threading.Tasks;
5-
using Newtonsoft.Json;
4+
using System.Text.Json;
65

76
namespace Consumer
87
{
98
public struct Product
109
{
11-
public string id;
12-
public string type;
13-
public string name;
10+
public string id { get; set; }
11+
public string type { get; set; }
12+
public string name { get; set; }
1413
}
1514

1615
public class ProductClient
@@ -25,7 +24,7 @@ public class ProductClient
2524

2625
var resp = await response.Content.ReadAsStringAsync();
2726

28-
return JsonConvert.DeserializeObject<List<Product>>(resp);
27+
return JsonSerializer.Deserialize<List<Product>>(resp);
2928
}
3029
}
3130
}

src/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Net.Http;
4-
using System.Threading.Tasks;
53

64
namespace Consumer
75
{

src/consumer.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

8-
<ItemGroup>
9-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
10-
</ItemGroup>
11-
128
<ItemGroup>
139
<PackageReference Include="FluentAssertions" Version="6.12.1" />
1410
</ItemGroup>

tests/ConsumerPactTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ namespace tests
1616
{
1717
public class ConsumerPactTests
1818
{
19-
private IPactBuilderV4 pact;
20-
// private readonly int port = 9222;
21-
19+
private readonly IPactBuilderV4 pact;
2220
private readonly List<object> products;
2321

2422
public ConsumerPactTests(ITestOutputHelper output)

0 commit comments

Comments
 (0)