I'm having a model which contains a property of type List<List<String>>, I tried to pass a model from the postman it receives null instead of the actual data.
Technology: JAVA SE 11 - Spring Book Maven Application - AWS Lambda
Sample Model
public class KeyParamInfo {
private String key;
private List<List<String>> referenceData;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public List<List<String>> getReferenceData() {
return referenceData;
}
public void setReferenceData(List<List<String>> referenceData) {
this.referenceData = referenceData;
}
}
The respective Body Data in PostMan is
{
"key":"PROG",
"referenceData":[
[
"JAVA",
"KOTLIN"
],
[
"HTML",
"JS"
]
]
}
Java Code:
public class SampleApplication implements RequestHandler<KeyParamInfo, List<String>> {
public List<String> handleRequest(KeyParamInfo input, Context context) {
List<String> response = new ArrayList<String>();
try {
if(input != null) {
if(input.getReferenceData() != null) {
response.add("Reference Data Received");
}
else if(input.getKey() != null && !input.getKey().equals("")) {
response.add("Data Received with key " + input..getKey());
}
else {
response.add("Empty Data Object");
}
} else {
response.add("Invalid Data");
}
} catch (Exception e) {
response.add("Exception occured in Main method - " + e.getMessage());
}
return response;
}
}
Following is the response returns from the above code ["Data Received with key PROG"]
AWS Lambda Documentation: https://docs.aws.amazon.com/lambda/index.html
In the application the referenceData receives the value null instead of the above nested list. Please assist how to pass the requested nested list into JAVA.