Ejemplo n.º 1
0
        /// <summary>
        /// Convert a string to an IExpando.
        /// </summary>
        /// <exception cref="">Throws an exception when the string passed in cannot be parsed.</exception>
        /// <param name="jsonToParse"></param>
        /// <returns></returns>
        public Expando ParseJSON(String jsonToParse)
        {
            Expando retval       = new Expando();
            var     memberstring = _rxObject.Match(jsonToParse).Groups["obj"].Value;
            Match   m;

            do
            {
                m = _rxPair.Match(memberstring);
                if (m.Success)
                {
                    retval[m.Groups["key"].Value] = this.ParseMember(m.Groups["value"].Value);
                    memberstring = memberstring.Remove(0, m.Length);
                }
            } while (m.Success && memberstring.Length > 0);
            return(retval);
        }