On Jul 23, 4:18 am, Xavier Beaudouin <[email protected]> wrote:
> Please apologize-me if this has been discussed here before, but I try to
> find a good way to "jsonify" some data I have in DB.

It's not clear what SQL database and what node module/addon you are
using.

> Here an extract of code I have done (currently its sends an HTML table,
> but I want this in pure JSON only) [code simplified] :
>
> var lSql = 'SELECT .... AND (date >= $1 AND date <= $2)) ORDER BY
> requests desc';
> client.query(lSql, [sDate, eDate], function(err, result)
> {

If all you want is JSON, just do: JSON.stringify(result.rows);

That will return a JSON string of your rows.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to