Skip to content

Commit

Permalink
MAINTENANCE: Use System.Text.Json for all targets
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Slachta <[email protected]>
  • Loading branch information
jslachta committed Oct 15, 2021
1 parent 9a584f4 commit d9b63ae
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion src/LocaleNames/LocaleNames.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard2.0'))">
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Text.Json" Version="5.0.0" />
</ItemGroup>

<Import Project="Resources.include" />
Expand Down
8 changes: 0 additions & 8 deletions src/LocaleNames/LocaleTranslations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
using System.Globalization;
using System.IO;
using System.Linq;
#if NETSTANDARD2_0
using Newtonsoft.Json;
#else
using System.Text.Json;
#endif

namespace LocaleNames
{
Expand Down Expand Up @@ -243,11 +239,7 @@ private bool LoadDictionary(string key, string postfix, ref IDictionary<string,
var compressedResourceValue = streamReader.ReadToEnd();
var decompressedResourceValue = GzipUtils.Decompress(compressedResourceValue);

#if NETSTANDARD2_0
dict = JsonConvert.DeserializeObject<ResourceLocale>(decompressedResourceValue).Values;
#else
dict = JsonSerializer.Deserialize<ResourceLocale>(decompressedResourceValue).Values;
#endif

isFound = true;
}
Expand Down

0 comments on commit d9b63ae

Please sign in to comment.