1

I send response as

 return httpres.status(200).send({ "Status"  :    Status_id['Status'] })   

inside get() method, may be due to wrong headers ,I'm receiving data in wrong json format in client:

 Object { _body: "{\"Status\":222}", status: 200, ok: true, statusText: "OK", headers: {…}, type: 2, url: "http://localhost:3000/api/spf_ids/1" }

This is what I need

 {\"Status\":222}// This is wrong json format slashes are coming by default

2 Answers 2

1

It's important that you set the Content-Type header to application/json. but if you want to send it in a object style you can stringify it:

 return httpres.status(200).send(JSON.stringify({ "Status"  :    Status_id['Status']}))   
Sign up to request clarification or add additional context in comments.

Comments

1

Try this:

return res.status(200).json({ "Status"  :    Status_id['Status'] })

Comments

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.