Escaping return carriage in json message body

Hi,

Am using logstash-input-azureeventhub plugin to get data from Azure event hub. Am getting json parse error on return carriages when trying to import data. Please see below:

Message:
{"app_Name":"KalimTest","Value":"hello \n world"}

Logstash Config:
azureeventhub {
key => "myKey"
username => "usename
namespace => "myNamespace"
eventhub => "my evenhubname"
partitions => 4
thread_wait_sec => 10
}

Error in logstash:

{:timestamp=>"2016-08-23T16:34:11.981000+0000", :message=>"JSON parse failure. Falling back to plain-text", :error=>#<LogStash::Json::ParserError: Unrecognized character escape 'x' (code 120)
at [Source: [B@7b51d3a1; line: 1, column: 42]>, :data=>"{"app_Name":"KalimTest","Value":"hello \x5c\x5cn world"}", :level=>:info, :file=>"/logstash/logstash-2.3.3/vendor/bundle/jruby/1.9/gems/logstash-codec-json-2.1.4/lib/logstash/codecs/json.rb", :line=>"67", :method=>"legacy_parse"}

How can I escape certain characters in json? Perhaps via a filter? I've tried gsub but of course it won't parse JSON. I'v tried double slash (\n) in original message but to no avail

Please advise.

Cheers,

Kalim

So I got around the problem by adding the following filter. Issue with plugin obviously still exists. I believe this to be an issue with the json codec provided by Logstash which the plugin is using.
mutate { replace => [ "message", "%{message}" ] gsub => [ 'message','\\x5cr','', 'message','\\x5cn','' ] } if [message] =~ /^{.*}$/ { json { source => message } }