# Quote escaping bug in logstash configs

**URL:** <https://discuss.elastic.co/t/quote-escaping-bug-in-logstash-configs/60112>\
**Category:** Logstash\
**Created:** [September 8, 2016, 8:05pm UTC](https://discuss.elastic.co/t/quote-escaping-bug-in-logstash-configs/60112 "2016-09-08T20:05:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaung/32/11165_2.png) [@kaung](https://discuss.elastic.co/u/kaung)\
**Post date:** [September 8, 2016, 8:05pm UTC](https://discuss.elastic.co/t/quote-escaping-bug-in-logstash-configs/60112/1 "2016-09-08T20:05:04Z")

</div>

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"...`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:38am UTC](https://discuss.elastic.co/t/quote-escaping-bug-in-logstash-configs/60112/3 "2017-07-06T04:38:52Z")

</div>


