我在visual studio 2017中使用c#创建了一个aws lambda函数,我遇到了参数问题。我试图得到'querystring参数' 但每次我在我的FunctionHandler中的一个参数,我得到这个错误。AWS Lambda中的JsonReaderException C#函数
{
"errorType": "JsonReaderException",
"errorMessage": "Unexpected character encountered while parsing value: {. Path '', line 1, position 1.",
"stackTrace": [
"at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)",
"at Newtonsoft.Json.JsonTextReader.ReadAsString()",
"at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)",
"at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)",
"at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)",
"at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)",
"at lambda_method(Closure , Stream , Stream , ContextInfo)"
]
}
这是我的示例代码FunctionHandler:
public string FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context)
{
var sample = GetParameters(request.QueryStringParameters, "sample");
return sample;
}
这有什么错呢?答案将非常感激。谢谢 !
UPDATE
什么是你输入的输入拉姆达? – Kannaiyan
我通过API网关传递查询参数。 – anonymous
您能否请您提供如何传递参数,我的意思是JSON值的格式 – msoliman