1

I'm currently learning Azure Functions in my Back-end development. The problem is that using Azure Functions prevents my JavaScript code to return a simple JSON object in Postman. I've read the documentation and also tried using some JS functions like JSON.Stringify, but still no luck. Here's the sample of my code:

message = {
   success: true,
   status: 'pending',
   message: "Some message etc..."
}
return message;

I'm practically new to Azure, so any help will be appreciated. Thanks!

1 Answer 1

2

Try this ...

// Construct response
const responseJSON = {
    "name": "Some name",
    "sport": "Some sport",
    "message": "Some message",
    "success": true
}

context.res = {
    // status: 200, /* Defaults to 200 */
    body: responseJSON,
    contentType: 'application/json'
};
Sign up to request clarification or add additional context in comments.

1 Comment

It works. Thanks a lot man! :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.