简体   繁体   English

Lambda output 应该遵循下一个 JSON 格式

[英]Lambda output should follow the next JSON format

I am pretty sure that my return response is acceptable but for some reason, I am still getting the error Lambda output should follow the next JSON format: { "isBase64Encoded": true|false, "statusCode": httpStatusCode, "headers": { "headerName": "headerValue", ... },"body": "..."} . I am pretty sure that my return response is acceptable but for some reason, I am still getting the error Lambda output should follow the next JSON format: { "isBase64Encoded": true|false, "statusCode": httpStatusCode, "headers": { "headerName": "headerValue", ... },"body": "..."} Weirdly enough, the same code could run properly without any mistakes in my team's systems.奇怪的是,相同的代码可以在我团队的系统中正常运行而不会出现任何错误。

return {
    'statusCode': 200,
    'body': response_json
}

response_json is [{'val1': 'val2'}, {'val3': 'val4'}] response_json 是[{'val1': 'val2'}, {'val3': 'val4'}]

Can someone please guide me as to what I may be doing wrong here that's causing this?有人可以指导我了解我在这里可能做错了什么吗?

I have tried to use json.dumps(response_json) , also check the type of response _json which is list so it should work but it's not.我尝试使用json.dumps(response_json) ,还检查响应 _json 的类型,它是列表,所以它应该可以工作,但它不是。

with json.dupms json.dumps(response_json)与 json.dupms json.dumps(response_json)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM