Ejemplo n.º 1
0
        protected override void ParseBody(string data)
        {
            if (IsGzipEncoded())
            {
                data = TryDeflateDecoded(data);
            }
            // Some weired hash leading..
            var jsonString = Regex.Replace(data, @"\![a-z0-9]+$", "", RegexOptions.IgnoreCase);

            // In case of BOM of doom..
            jsonString = Regex.Replace(jsonString, "^", "");
            if (jsonString.Length == 0)
            {
                BodyJson   = null;
                BodyString = "";
                return;
            }

            // ... check for missing value..
            if (jsonString.Length > 0 && jsonString.Substring(jsonString.Length - 1, 1) == ":")
            {
                // Fix it with zero for now...
                jsonString += "0";
            }

            // Omfg.. seems like the removed the closing tags? Try to read it with a custom parser
            BodyJson   = JsonParser.Deserialize(jsonString);
            BodyString = BodyJson.ToString();
        }
Ejemplo n.º 2
0
 protected override void ParseBody(string jsonString)
 {
     try {
         BodyJson   = JsonParser.Deserialize(jsonString);
         BodyString = BodyJson.ToString();
     } catch {
         BodyJson   = null;
         BodyString = jsonString;
     }
 }