How to send JSON response to AWS Alexa skill from JAVA



JSONObject outputSpeechContent = new JSONObject();
outputSpeechContent.put("type", "PlainText");
outputSpeechContent.put("text", engineResponse.getText());
JSONObject outputSpeech = new JSONObject();
outputSpeech.put("outputSpeech", outputSpeechContent);

JSONObject resObj = new JSONObject();
resObj.put("version", "1.01");
resObj.put("response", outputSpeech);
response.setStatusCode(200);
Did you find this post useful? Show some love!
Classic DEV Post from Jul 4

The New Golden Rule of Programmers

It's time to make a golden rule for programmers in shared office space

READ POST
Follow @benhayehudi to see more of their posts in your feed.
dev.to is now open source!
View Announcement Post View GitHub Repo
#Muthupandian (mu)
Member since Feb 4, 2017
More from @mu
Programmatically check table exist in AWS Dynamo DB from Lambda function
#serverless #java
Trending on dev.to
What part of your first dev job were you least prepared for?
#discuss #career
Tell me a good IT joke
#discuss #jokes #fun
Java Crash Course Suggestions
#java #eclipse #discuss
The distraction's killer
#beginners #help #career
I Failed as a Developer. And so did you.
#opensource #career #webdev #discuss
How many computers do you use?
#discuss
Style your Terminal better by mastering these settings 🀩
#terminal #productivity #tools #webdev
Logic of the JWT(JSON Web Tokens)
#webdev #php #java #beginners