Gili Nachum Gili Nachum - 7 months ago 20
JSON Question

How to pretty print json objects to db using Node-orm2

I'm using node-orm2 to persist a model to a mysql db column. It works great, except I want the written json pretty printed, so I can easily read it when I view the DB.

Is this possible?


you can use JSON stringify with params:

var obj = {manu: true, gili: "abc"}
var str = JSON.stringify(obj, null, 4); // spacing = 4