function UnCastType($type, $data, &$row = null) {
		switch ($type) {
			case 'json':
				return json_encode($data);
			case 'json-import':
				if (!is_array($data))
					$data = array();
				foreach ($row as $key => $val) {
					if (substr($key, 0, 1) == '_') // Skip meta fields
						continue;
					if (!isset($this->schema[$key])) { // This key is unrecognised - import into JSON blob
						$data[$key] = $val;
						unset($row[$key]);
					}
				}
				$data = json_encode($data);
				return $data;
			default: // No idea what this is or we dont care
				return $data;
		}
	}