private object ReadToken(StreamReader sr)
        {
            EatWhitespace(sr);

            char c = sr.ReadChar();
            switch (c)
            {
                case '{':
                    return ReadDict(sr);
                case '/':
                    {
                        if (sr.PeekChar() == '/')
                        {
                            sr.ReadLine();
                            return null;
                        }
                        else
                        {
                            return ReadString(sr, c);
                        }
                    }

                default:
                    return ReadString(sr, c);
            }
        }
 private void EatWhitespace(StreamReader sr)
 {
     while (char.IsWhiteSpace(sr.PeekChar()))
     {
         sr.ReadChar();
     }
 }
        private string ReadString(StreamReader sr, char firstChar)
        {
            StringBuilder sb = new StringBuilder();

            bool readToQuote = false;

            if (firstChar == '"')
            {
                readToQuote = true;
            }
            else
            {
                sb.Append(firstChar);
            }

            while (true)
            {
                char c = sr.ReadChar();

                if (char.IsWhiteSpace(c) && !readToQuote)
                {
                    return sb.ToString();
                }
                else if (c == '"' && readToQuote)
                {
                    return sb.ToString();
                }
                else if (c == '\\')
                {
                    char escaped = sr.ReadChar();
                    switch (escaped)
                    {
                        case 'n':
                            sb.Append((char)0x0A);
                            break;
                        case 'r':
                            sb.Append((char)0x0D);
                            break;
                        default:
                            sb.Append(escaped);
                            break;
                    }
                }
                else
                {
                    sb.Append(c);
                }
            }
        }
 private string ReadString(StreamReader sr)
 {
     return ReadString(sr, sr.ReadChar());
 }
        private Dictionary<string, object> ReadDict(StreamReader sr)
        {
            Dictionary<string, object> dict = new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);

            EatWhitespace(sr);
            while (sr.PeekChar() != '}')
            {
                EatWhitespace(sr);
                object keyToken = ReadToken(sr);
                if (keyToken != null)
                {
                    string key = (string)keyToken;
                    object value = ReadToken(sr);
                    dict.Add(key, value);
                }
                EatWhitespace(sr);
            }
            sr.ReadChar(); // eat the }

            return dict;
        }