aws-lambda-dotnet icon indicating copy to clipboard operation
aws-lambda-dotnet copied to clipboard

How to use custom JSON converters with Lambda function

Open tap-andy opened this issue 7 years ago • 1 comments

I've created a Lambda function using the VS extension. I want to change my function to serialize enum values as strings. I can see that there are several constructors for the JsonSerializer class, one of which allows you to specify custom converters. The problem is, I can't figure out how I'm meant to use these extra constructors.

By default, the scaffolded function code just adds the LambdaSerializer attribute to the assembly and I guess this just uses the parameterless constructor. How can I change my function to use a different constructor and give it the necessary enum converter?

tap-andy avatar Oct 01 '19 12:10 tap-andy

This README provides a little more info. You'll need to write your own serializer that implements the ILambdaSerializer interface. Can you take a look at this documentation, read some more about JSON serializers, and let us know if you are still having issues?

klaytaybai avatar Oct 01 '19 22:10 klaytaybai