`std.json` refactoring, fixing and adding formatting support

* fix indention
* put open brackets on its own line
* minor refactoring
* fix issue in when `null` is returned instead of empty string/array
* add formatting option to `toJSON`.
* rename `JSON_TYPE` to conform naming conventions