The operation
A precise JSON prettifier, defined exactly
The operation this JSON prettifier performs is narrow and worth stating precisely: the input is parsed into a value, and that value is serialised back out with two spaces of indentation per nesting level. Parse, then serialise. Nothing else happens in between.
Everything that follows is a consequence of that definition. The transformation is lossless with respect to the data, because the data is reconstructed from a parsed representation rather than edited as text. It is also strict, because a parse either succeeds or it does not. And it is local: the parse and the serialise both execute in the browser, so the input is never transmitted, which in turn means there is no run limit and no length cap to enforce.