Quote escaping bug in logstash configs

One of my configuration, which is actually a sql query, contains both single and double quote chars. So, the usually preferred way to do single quote wrapping double quotes (or the other way round) cannot be used. I need to explicitly escape with "" but that kind of escape has the following defect:

I do this

mutate {
add_field => { "foo" => 'string with " and ' chars' }
add_field => { "bar" => "string with " and ' chars" }
}

And, I output the result to file with json_lines codec.

Expected result:

..."foo":"string with \" and ' chars","bar":"string with \" and ' chars" ...

Actual result:

... "foo":"string with \" and \' chars","bar":"string with \\" and ' chars"...