Escape JSON Keys in Logstash

I'm new to the logstash topic and want to log JSON data I'm getting from systems I have no control over.
They send me JSON strings which can include characters like a '.' or '$' in their keys because they are sometimes IRIs.

I've noticed before that e.g. mongodb does not allow these kind of keys. I've also tried to send json strings to logstash by hand. All json strings with these "unescaped" keys will not be inserted into elastic search.

I wonder if there is a way to escape those characters. Currently I'm running a nodejs app which receives the data, escapes them and forwards them to logstash. But there must be a simpler way?

Many Thanks in advance, Daniel

A simple example would of an JSON-String that will not be processed is:

{ "": { "a": "", "b": "" } }

Perhaps if you provide a sample of the data someone can help.