public static function prettyJson($json, $indString = "\t") {
		// Replace any escaped \" marks so we don't get tripped up on quotemarks_counter
		$tokens = preg_split('|([\{\}\]\[,])|', str_replace('\"', '~~PRETTY_JSON_QUOTEMARK~~', $json), -1, PREG_SPLIT_DELIM_CAPTURE);

		$indent = 0;
		$result = '';
		$quotemarksCounter = 0;
		$nextTokenUsePrefix = true;

		foreach ($tokens as $token) {
			$quotemarksCounter = $quotemarksCounter + (count(explode('"', $token)) - 1);

			if ($token === '') {
				continue;
			}

			if ($nextTokenUsePrefix) {
				$prefix = str_repeat($indString, $indent);
			} else {
				$prefix = null;
			}

			// Determine if the quote marks are open or closed
			if ($quotemarksCounter & 1) {
				// odd - thus quotemarks open
				$nextTokenUsePrefix = false;
				$newLine = null;
			} else {
				// even - thus quotemarks closed
				$nextTokenUsePrefix = true;
				$newLine = "\n";
			}

			if ($token === '{' || $token === '[') {
				$indent++;
				$result .= $token . $newLine;
			} elseif ($token === '}' || $token === ']') {
				$indent--;

				if ($indent >= 0) {
					$prefix = str_repeat($indString, $indent);
				}

				if ($nextTokenUsePrefix) {
					$result .= $newLine . $prefix . $token;
				} else {
					$result .= $newLine . $token;
				}
			} elseif ($token === ',') {
				$result .= $token . $newLine;
			} else {
				$result .= $prefix . $token;
			}
		}
		return str_replace('~~PRETTY_JSON_QUOTEMARK~~', '\"', $result);
	}