Skip to content

Commit

Permalink
Replace Json.NET by System.Text.Json
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielweyer committed Jan 9, 2023
1 parent 360d937 commit 027ac30
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions coster/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<ItemGroup>
<PackageVersion Include="Nuke.Common" Version="6.3.0" />
<PackageVersion Include="CsvHelper" Version="30.0.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.2" />
<PackageVersion Include="coverlet.collector" Version="3.2.0" />
<PackageVersion Include="FluentAssertions" Version="6.8.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
Expand All @@ -21,4 +20,4 @@
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<AnalysisLevel>latest</AnalysisLevel>
</PropertyGroup>
</Project>
</Project>
1 change: 0 additions & 1 deletion coster/src/AzureVmCoster/AzureVmCoster.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

<ItemGroup>
<PackageReference Include="CsvHelper" />
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions coster/src/AzureVmCoster/Services/Pricer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Newtonsoft.Json;
using System.Text.Json;

namespace AzureVmCoster.Services;

Expand All @@ -21,7 +21,7 @@ public void EnsurePricingExists(List<InputVm> vms)

if (missingFiles.Count > 0)
{
throw new InvalidOperationException($"Pricing files are missing for {JsonConvert.SerializeObject(missingFiles)}");
throw new InvalidOperationException($"Pricing files are missing for {JsonSerializer.Serialize(missingFiles)}");
}
}

Expand Down
4 changes: 2 additions & 2 deletions coster/src/AzureVmCoster/Services/VmPricingParser.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Newtonsoft.Json;
using System.Text.Json;

namespace AzureVmCoster.Services;

Expand All @@ -22,7 +22,7 @@ public List<VmPricing> Parse()
var fileInfo = new FileInfo(pricingFile);
var fileIdentifier = FileIdentifier.From(fileInfo);

var fileVmPricing = JsonConvert.DeserializeObject<List<VmPricing>>(File.ReadAllText(pricingFile));
var fileVmPricing = JsonSerializer.Deserialize<List<VmPricing>>(File.ReadAllText(pricingFile));

if (fileVmPricing == null || !fileVmPricing.Any())
{
Expand Down

0 comments on commit 027ac30

Please sign in to comment.