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);
	}