예제 #1
0
        /// <summary>
        /// Serialize the Json three
        /// </summary>
        /// <param name="quotesOnNames">User '"' in name of objects</param>
        /// <returns></returns>
        public string ToJson(bool format = true)
        {
            interfaceSemaphore.WaitOne();
            string result = root.ToJson(true, format);

            interfaceSemaphore.Release();
            return(result);
        }
예제 #2
0
        /// <summary>
        /// returns the value of an json object as a json string (Serialize an object)
        /// </summary>
        /// <param name="objectName">The object name</param>
        /// <param name="quotesOnNames">User '"' in names</param>
        /// <returns></returns>
        public string get(string objectName, bool format = false, bool quotesOnNames = true, string valueOnNotFound = "undefined")
        {
            interfaceSemaphore.WaitOne();
            IJSONObject temp = this.find(objectName, false, this.root);

            interfaceSemaphore.Release();
            if (temp != null)
            {
                return(temp.ToJson(quotesOnNames, format));
            }
            else
            {
                return(valueOnNotFound);
            }
        }