Skip to content

inanc/aws-lambda-apigateway-flatten-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This example code is used for running a Java Lambda using API Gateway trigger. It uses AWS Lambda Core SDK for RequestStreamHandler implementation which is called by the trigger

Description

An AWS Lambda API Gateway Java application takes an arbitrary array of arrays with numbers and flattens it into a single array

The AWS service via the API Gateway takes input as application/json:

{"input":[1,[2,3,[4]],[5],6,[7,[8]]]}

And return output as application/json:

{"output":[1,2,3,4,5,6,7,8]} 

Curl URL

curl --location --request POST 'https://plmc541.execute-api.us-east-1.amazonaws.com/array' \
--header 'Content-Type: application/json' \
--data-raw '{"input":[1,[2,2,3,[4,7,11,8]],[5,4,15],6,[7,[8,9]]]} '

Response:

{"output":[1,2,2,3,4,7,11,8,5,4,15,6,7,8,9]}

How to build

mvn compile
mvn package

About

An AWS Lambda API Gateway Java application flattens nested arrays into a single array

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages