Fix range violation when building JSON parser error message. Fixes #805.