Amazon.Lambda.Serialization.SystemTextJson 2.3.0 The ID prefix of this package has been reserved for one of the owners of this package by Prefix Reserved

.NET 6.0 .NET Core 3.1
Install-Package Amazon.Lambda.Serialization.SystemTextJson -Version 2.3.0
dotnet add package Amazon.Lambda.Serialization.SystemTextJson --version 2.3.0
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Amazon.Lambda.Serialization.SystemTextJson --version 2.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Amazon.Lambda.Serialization.SystemTextJson, 2.3.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Amazon.Lambda.Serialization.SystemTextJson as a Cake Addin
#addin nuget:?package=Amazon.Lambda.Serialization.SystemTextJson&version=2.3.0

// Install Amazon.Lambda.Serialization.SystemTextJson as a Cake Tool
#tool nuget:?package=Amazon.Lambda.Serialization.SystemTextJson&version=2.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


This package contains a custom Amazon.Lambda.Core.ILambdaSerializer implementation which uses System.Text.Json to serialize/deserialize .NET types in Lambda functions. This serializer targets .NET Core 3.1 so can not be used with the .NET Core 2.1 Lambda runtime.

If targeting .NET Core 3.1 this serializer is highly recommend over Amazon.Lambda.Serialization.Json and can significantly reduce cold start performance in Lambda.

This serializer can be present on the assembly or on the handler method. If you specify both, the method attribute takes priority.

Here is an example of setting this attribute on the assembly.

[assembly: Amazon.Lambda.Core.LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]

And this is how the method can be applied to the handler method.

public Response CustomSerializerMethod(Request input)

Using C# source generator for serialization

C# 9 provides source generators, which allow code generation during compilation. This can reduce the use of reflection APIs and improve application startup time. .NET 6 updated the native JSON library System.Text.Json to use source generators, allowing JSON parsing without requiring reflection APIs.

To use the source generator for JSON serializing in Lambda, you must define a new empty class in your project that derives from System.Text.Json.Serialization.JsonSerializerContext. This class must be a partial class because the source generator adds code to this class to handle serialization. On the empty partial class, add the JsonSerializable attribute for each .NET type the source generator must generate the serialization code for.

Here is an example called HttpApiJsonSerializerContext that registers the Amazon API Gateway HTTP API event and response types to have the serialization code generated:

public partial class HttpApiJsonSerializerContext : JsonSerializerContext

To register the source generator for serialization use the LambdaSerializer attribute passing in the SourceGeneratorLambdaJsonSerializer type along with the custom context type (i.e. HttpApiJsonSerializerContext) as the generic parameter.

[assembly: LambdaSerializer(

Customizing serialization options

Both DefaultLambdaJsonSerializer and SourceGeneratorLambdaJsonSerializer construct an instance of JsonSerializerOptions that is used to customize the serialization and deserialization of the Lambda JSON events. For example adding special converters and naming policies.

To further customize the JsonSerializerOptions create a new type extending from extend either DefaultLambdaJsonSerializer or SourceGeneratorLambdaJsonSerializer and pass in an Action customizer to the base constructor. Then register the new type as the serializer using the LambdaSerializer attribute. Below is an example of a custom serializer.

public class CustomLambdaSerializer : DefaultLambdaJsonSerializer
    public CustomLambdaSerializer()
        : base(CreateCustomizer())
    { }

    private static Action<JsonSerializerOptions> CreateCustomizer()
        return (JsonSerializerOptions options) =>
            // Customize options
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (11)

Showing the top 5 NuGet packages that depend on Amazon.Lambda.Serialization.SystemTextJson:

Package Downloads
Amazon.Lambda.AspNetCoreServer The ID prefix of this package has been reserved for one of the owners of this package by

Amazon.Lambda.AspNetCoreServer makes it easy to run ASP.NET Core Web API applications as AWS Lambda functions.


A structured template to create AWS Lambda in C#. It supports Logging, Dependency Injection and Configuration like ASP.NET Core projects do.


Serverless .NET for AWS - Lambda Library


Package Description


Package Description

GitHub repositories (6)

Showing the top 5 popular GitHub repositories that depend on Amazon.Lambda.Serialization.SystemTextJson:

Repository Stars
Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Exceptionless clients for the .NET platform
Extensions to the dotnet CLI to simplify the process of building and publishing .NET Core applications to AWS services
.NET Tracer for Datadog APM
.NET Developer step by step guides for building solutions on AWS
Version Downloads Last updated
2.3.0 182,931 3/23/2022
2.2.0 1,214,822 11/5/2021
2.1.0 4,752,656 10/21/2020
2.0.2 402,513 9/16/2020
2.0.1 1,478,792 5/4/2020
2.0.0 811,728 4/28/2020
1.0.0 436,422 3/31/2020