original_string: public function generate_json($result=NULL, $match_array_type=FALSE) {
  		// JSON data can optionally be passed to this function
  		// either as a database result object or an array, or a user supplied array
  		if (!is_null($result)) {
  			if (is_object($result)) {
  				$json_result=$result->result_array();
  			} elseif (is_array($result)) {
  				$json_result=$result;
  			} else {
  				return $this->_prep_args($result);
  			}
  		} else {
  			return 'null';
  		}
  		return $this->_create_json($json_result, $match_array_type);
  	}
code: public function generate_json($result=NULL, $match_array_type=FALSE) {
  		// JSON data can optionally be passed to this function
  		// either as a database result object or an array, or a user supplied array
  		if (!is_null($result)) {
  			if (is_object($result)) {
  				$json_result=$result->result_array();
  			} elseif (is_array($result)) {
  				$json_result=$result;
  			} else {
  				return $this->_prep_args($result);
  			}
  		} else {
  			return 'null';
  		}
  		return $this->_create_json($json_result, $match_array_type);
  	}
code_tokens: public function generate_json ( $ result = NULL , $ match_array_type = FALSE ) { // JSON data can optionally be passed to this function // either as a database result object or an array, or a user supplied array if ( ! is_null ( $ result ) ) { if ( is_object ( $ result ) ) { $ json_result = $ result -> result_array ( ) ; } elseif ( is_array ( $ result ) ) { $ json_result = $ result ; } else { return $ this -> _prep_args ( $ result ) ; } } else { return 'null' ; } return $ this -> _create_json ( $ json_result , $ match_array_type ) ; }
docstring: Can be passed a database result or associative array and returns a JSON formatted string
  
  @param mixed $result result set or array
  @param bool $match_array_type match array types (defaults to objects)
  @return string json formatted string
docstring_tokens: Can be passed a database result or associative array and returns a JSON formatted string