Unable to send numbers using res.send() using express with node Unable to send numbers using res.send() using express with node json json

Unable to send numbers using res.send() using express with node


According to Express res.send([body]) docs:

The body parameter can be a Buffer object, a String, an object, or an Array

You can't send a number by itself.

Try either converting the number to a string

res.send(''+result.rows[0].doc.imdb.rating);

or send it as an object value

res.send({ result: result.rows[0].doc.imdb.rating});


this works, you have to convert it to a string:threeFunction().toString()orx1.toString()


Integer is not valid for res.send() so convert it to string.

res.send(value.toString())