Example #1
0
        /// <summary>
        /// Adds class implementing IJsonEncoder
        /// </summary>
        /// <param name="propertyName"></param>
        /// <param name="val"></param>
        /// <returns></returns>
        public JsonEncoder Add(string propertyName, IJsonEncoder val)
        {
            if (!String.IsNullOrEmpty(propertyName))
            {
                if (val == null)
                {
                    return(this);
                }
                else
                {
                    AddProp(propertyName);
                }
            }
            else if (val == null)
            {
                AddNull();
                return(this);
            }


            sb.Append("{");
            lastchar = '{';
            val.BiserJsonEncode(this);
            sb.Append("}");
            lastchar = '}';

            return(this);
        }
Example #2
0
 public JsonEncoder(IJsonEncoder obj, JsonSettings settings = null)
     : this(settings)
 {
     if (obj != null)
     {
         obj.BiserJsonEncode(this);
     }
 }
Example #3
0
        public JsonEncoder Add(IJsonEncoder val)
        {
            if (val == null)
            {
                AddNull();
                return(this);
            }


            sb.Append("{");
            lastchar = '{';
            val.BiserJsonEncode(this);
            sb.Append("}");
            lastchar = '}';

            return(this);

            //return Add(null,val);
        }