check if ActiveRecord before converting to json