add mode option to determine return object or json string