Unable to avoid JSON parsing errors in logstash log-file

I would use the json filter instead. You should add a conditional check to see if the message field "looks" like JSON.

if [message] =~ "\A\{.+\}\z" {
  json { .. }
}

or similar.
Be aware that the JSON might be an array of objects [{},{}]