Gili Nachum
Gili Nachum

Reputation: 5578

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?

Upvotes: 1

Views: 76

Answers (1)

Manu
Manu

Reputation: 99

you can use JSON stringify with params:

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

Upvotes: 1

Related Questions