Yes, but I think the plugin is the right place to do it. What is more, this won't actually prevent you completely from producing non-ECMAScript compliant JSON, since json or jsonb values containing offending numerics won't be caught, AIUI. But a fairly simple to write function that reparsed and fixed the JSON inside the decoder would work.
The OP admitted that this was a serious flaw in his approach. In fact, given that a json value can contain an offending numeric value, any approach which doesn't involve reparsing is pretty much bound to fail.
I agree that was a critical omission in my thinking.
Now, back to the whitespace issue: I could submit a patch to unify the whitespace w/o all the hairy callbacks. Did we have the consensus here: no spaces whatsoever unless some *_pretty function is used?