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!
DISCUSSION
Classic DEV Post from Mar 31

When did you stop thinking of yourself as a junior/newbie?

...

muTheTechie
Living at Whirldata

Do you write code almost every day?

Join dev.to ❀️