1

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?

1 Answer 1

1

you can use JSON stringify with params:

var obj = {manu: true, gili: "abc"}
var str = JSON.stringify(obj, null, 4); // spacing = 4
Sign up to request clarification or add additional context in comments.

1 Comment

All whitespaces are removed during save() when the field is of type Object :(. Will only work if field is defined and string and JSON stringify and parse are called after save/load.

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.