Switching the functional method to use objects that will be serialized to json.