Stringify and depth level for pretty export of json

I have an array that I would love to export as part of a json file but in a way that is more readible. I suppose stringify is being used under the hood, which will do a line break down to the deepest level. Is there a way to make it so that it line breaks and indents only down to a certain level and not past that without having to implement my own prettifier?


I use a regexp to limit the displayed depth of objects in the editor, could be a starting point : open-stage-control/ui-inspector-field.js at master · jean-emmanuel/open-stage-control · GitHub