Make sure leading whitespace is trimmed for parseJSON. Fixes #6031.