Fix formatting for `[1 2]` and similar

When validating expressions like `[1 2]`, the result is clearly invalid.
However, the formatter outputs the following:

```
[
    12
]
```

Clicking Validate for a second time would now return this as valid.

The commit attempts to preserve some of the whitespace in invalid JSON. It's
not perfect, but it avoids the scenario described above.