protected function _jsonEncode($in, $indent = 0)
    {
        $out = '';

        foreach ($in as $key => $value) {

            $out .= str_repeat("    ", $indent + 1);
            $out .= json_encode((string)$key) . ': ';

            if (is_object($value) || is_array($value)) {
                $out .= $this->_jsonEncode($value, $indent + 1);
            } else {
                $out .= json_encode($value);
            }

            $out .= "," . PHP_EOL;
        }

        if (!empty($out)) {
            $out = substr($out, 0, -2);
        }

        $out = "{" . PHP_EOL . $out . PHP_EOL . str_repeat("    ", $indent) . "}";

        return $out;
    }