I have an array:
arr = ["dog", "cat", "eel"]
And I'd like to convert it into a JSON like so:
'{"dog": {}, "cat": {}, "eel": {} }'
And NOT:
'{"dog"=> {}, "cat"=> {}, "eel"=> {} }'
I've tried using:
res = arr.each_with_object({}) { |k,h| h[k] = {} }
I feel like I'm missing something quite obvious. Is there a way to single quote it upon response?