Skip to content

Commit

Permalink
Give up and use newtonsoft
Browse files Browse the repository at this point in the history
  • Loading branch information
RobKraft committed Dec 4, 2024
1 parent 08024e4 commit 3c4fc25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
22 changes: 3 additions & 19 deletions Lambdas/GetCharityTypes/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
using MySql.Data.MySqlClient;
using Amazon.RDS.Util;
using Amazon;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using System.Text.Json.Nodes;
using Newtonsoft.Json;
namespace GetCharityTypes;

public class Function
Expand Down Expand Up @@ -68,25 +65,12 @@ public static async Task<string> FunctionHandler(ILambdaContext context)
{
Console.WriteLine($"connstring={_connectionString} and error: {ex.Message}");
}
var jsonNode = JsonNode.Parse(JsonSerializer.Serialize(types));
string json = jsonNode.ToJsonString();
string json = JsonConvert.SerializeObject(types);
return json;
}
}
[JsonSourceGenerationOptions(
WriteIndented = true,
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
GenerationMode = JsonSourceGenerationMode.Serialization)]
[JsonSerializable(typeof(CharityType))]
public class CharityType //: JsonSerializerContext
public class CharityType
{
public int Id { get; set; }
public string Type { get; set; } = string.Empty;

//protected override JsonSerializerOptions? GeneratedSerializerOptions => throw new NotImplementedException();

//public override JsonTypeInfo? GetTypeInfo(Type type)
//{
// throw new NotImplementedException();
//}
}
1 change: 1 addition & 0 deletions Lambdas/GetCharityTypes/GetCharityTypes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
<PackageReference Include="MySql.Data" Version="9.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>

0 comments on commit 3c4fc25

Please sign in to comment.