-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NETCore31] Add support for using System.Text.Json as the serialization parser #568
Conversation
… still lots of failing tests.
…w Amazon.Lambda.Serialization.SystemTextJson for .NET Core 3.1
Also remove the netstandard1.3 target framework since .NET Core 1.0 is out of support.
There is a .NET Standard package for this which makes it available to 2.1 |
Libraries/src/Amazon.Lambda.Serialization.SystemTextJson/AwsNamingPolicy.cs
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.Serialization.SystemTextJson/Converters/DateTimeConverter.cs
Outdated
Show resolved
Hide resolved
_options = new JsonSerializerOptions() | ||
{ | ||
IgnoreNullValues = true, | ||
PropertyNameCaseInsensitive = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there more annotations that could be added that would make it possible to remove this? It comes with a performance penalty to some degree, so would be better if it could be left off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking users could use the constructor that takes in Action<JsonSerializerOptions> customizer
to customize or remove these settings. I'm open to suggestions to make it easier.
@msimpsonnz That was my original attention to use the NuGet package for .NET Core 2.1. The problem is the AWS event packages require customization of the .NET Property name to JSON Property name mapping. For Newtonsoft we could add |
Issue #, if available:
#544
Description of changes:
.NET Core 3.0 added a new JSON serialization called System.Text.Json. This PR creates new Lambda serialization called Amazon.Lambda.Serialization.SystemTextJson that will be based on System.Text.Json. Unlike Newtonsoft's JSON parser System.Text.Json is built into the framework and is optimized for speed.
This will released as part of the upcoming Lambda .NET Core 3.1 and will only target .NET Core 3.1. There will not be a .NET Standard 2.0 which would make it available to .NET Core 2.1 Lambda functions because the event packages like Amazon.Lambda.S3 would have to take a dependency on the System.Text.Json Nuget package.
In my anecdotal testing I have seen some good cold start performance improvements using this library. For those that are currently trying .NET Core 3.1 on Lambda using the custom runtime feature here are preview versions of the impacted NuGet packages to try out.
https://normj-packages.s3.us-west-2.amazonaws.com/System.Text.Json-2020-01-17.zip
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.