Ejemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        private JObject FormObject()
        {
            JObject jObject = new JObject();

            //we are at the start of object
            this.parseIndex++;

            while (true)
            {
                //skip any white space
                this.SkipWhiteSpace();

                //skip command separator
                this.SkipCommaSeparator();

                //skip any white space
                this.SkipWhiteSpace();

                //get the property
                string property = this.FormString();

                //skip any white space
                this.SkipWhiteSpace();

                //skip colon separator. find the key:value separator
                this.SkipColonSeparator();

                //skip any white space
                this.SkipWhiteSpace();

                //For empty objects {}
                //check if we have reached the end of the object or else continue
                if (this.IsEndOfObject())
                {
                    break;
                }

                //extract value
                object value = this.FormValue();

                //add the property and value to the jobject
                jObject.Add(property, value);

                //skip any white space
                this.SkipWhiteSpace();

                //skip command separator
                this.SkipCommaSeparator();

                //skip any white space
                this.SkipWhiteSpace();

                //check if we have reached the end of the object or else continue
                if (this.IsEndOfObject())
                {
                    break;
                }
            }

            return jObject;
        }