Iterate through ruby data hash to create js equivalent data hash