JSON.generate fails if it is passed a Chef::Attributes instance. 

Call #to_hash to ensure it always receives a hash.