diff --git a/Lambdas/GetCharityTypes/Function.cs b/Lambdas/GetCharityTypes/Function.cs index a9b96ad..8253d6c 100644 --- a/Lambdas/GetCharityTypes/Function.cs +++ b/Lambdas/GetCharityTypes/Function.cs @@ -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 @@ -68,25 +65,12 @@ public static async Task 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(); - //} } diff --git a/Lambdas/GetCharityTypes/GetCharityTypes.csproj b/Lambdas/GetCharityTypes/GetCharityTypes.csproj index 85e3f8c..592a20f 100644 --- a/Lambdas/GetCharityTypes/GetCharityTypes.csproj +++ b/Lambdas/GetCharityTypes/GetCharityTypes.csproj @@ -32,5 +32,6 @@ + \ No newline at end of file