morgan-body icon indicating copy to clipboard operation
morgan-body copied to clipboard

How to set the indent of JSON.stringify?

Open xuesichao opened this issue 1 year ago • 1 comments

When I use morgan-body, the indent is somehow set tot 8 spaces. I want to change it to 2 spaces but don't know how to do that.

The only way that works for me is to overwrite the original JSON.stringify.

const originalStringify = JSON.stringify;
JSON.stringify = function(value, replacer = null) {
  return originalStringify(value, replacer, 2);
};

xuesichao avatar Jan 17 '24 17:01 xuesichao

ah - no one has asked for this one, feel free to add it as an option with a pull request

sirrodgepodge avatar Apr 10 '24 19:04 sirrodgepodge