Fix json serialization error

This commit is contained in:
Chris Bell 2024-11-17 20:53:23 -06:00
parent d9124434bb
commit 1d0f6e3b67
2 changed files with 14 additions and 14 deletions

View File

@ -1,4 +1,5 @@
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization.Metadata;
using Newtonsoft.Json; using Newtonsoft.Json;
using Raylib_cs; using Raylib_cs;
using JsonSerializer = System.Text.Json.JsonSerializer; using JsonSerializer = System.Text.Json.JsonSerializer;
@ -15,7 +16,8 @@ public class Tile
private static JsonSerializerOptions _jsonSerializerOptions = new() private static JsonSerializerOptions _jsonSerializerOptions = new()
{ {
WriteIndented = true WriteIndented = true,
TypeInfoResolver = new DefaultJsonTypeInfoResolver()
}; };
public static Tile GenerateTileFromJson(string jsonPath) public static Tile GenerateTileFromJson(string jsonPath)

View File

@ -1,23 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<PublishSingleFile>true</PublishSingleFile>
<PublishFileExclusionsFromSatelliteAssemblies>$(PublishFileExclusionsFromSatelliteAssemblies);data/**/*.*</PublishFileExclusionsFromSatelliteAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Raylib-cs" Version="6.1.1" /> <PackageReference Include="Raylib-cs" Version="6.1.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="data/**/*.*" CopyToOutputDirectory="PreserveNewest" /> <Content Include="data/**/*.*" CopyToOutputDirectory="Always" /> </ItemGroup>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="data\core\" /> <Folder Include="data\core\" />
</ItemGroup> </ItemGroup>
</Project> </Project>