I have a program that can deliver its reports to a variety of destinations including flat files, elasticsearch DB and our call management system.
I have a set to Dest classes which attend to the details of getting the data into the right format for the intended destination. Not surprisingly, the ES one uses a puts.item.to_json to deliver its output (where item is a hash)
The problem is that some hashes are printed as "{\"key\":\"value\"}"
and others print 'correctly' i.e without the ". I know that the output from to_json has the escapes in the output so that it produces the expected result with puts but in my case this works just some of the time.
Coping with the two types of behaviour is painful!
Any ideas what is going on?