Exemple #1
0
        /// <exception cref="System.IO.IOException"></exception>
        public virtual IDictionary <string, object> GetReplicationAuthParsedJson()
        {
            var authJson = "{\n" + "    \"facebook\" : {\n" + "        \"email\" : \"[email protected]\"\n"
                           + "     }\n" + "   }\n";

            mapper = new ObjectWriter();
            var authProperties = mapper.ReadValue <Dictionary <string, object> >(authJson);

            return(authProperties);
        }
        protected internal virtual object ParseJSONResponse(URLConnection conn)
        {
            object result       = null;
            Body   responseBody = conn.GetResponseBody();

            if (responseBody != null)
            {
                byte[] json       = responseBody.GetJson();
                string jsonString = null;
                if (json != null)
                {
                    jsonString = Sharpen.Runtime.GetStringForBytes(json);
                    try
                    {
                        result = mapper.ReadValue <object>(jsonString);
                    }
                    catch (Exception)
                    {
                        Fail();
                    }
                }
            }
            return(result);
        }