only convert to json if params is a hash