Example #1
0
        private static string Filter(string a, JSONChildrenType type)
        {
            string ret = a;

            switch (type)
            {
            case JSONChildrenType.STRING:
                ret = ret.Replace("\\", "\\\\");
                ret = ret.Replace("\"", "\\\"");
                ret = ret.Replace("\n", "\\\n");
                ret = ret.Replace("\r", " ");
                ret = ret.Replace("\t", " ");
                ret = "\"" + ret + "\"";
                ret = Json.EncodeNonAsciiCharacters(ret);

                break;

            case JSONChildrenType.BOOLEAN:
                if (Convert.ToBoolean(ret) == true)
                {
                    ret = "true";
                }
                else
                {
                    ret = "false";
                }
                break;
            }
            return(ret);
        }
Example #2
0
 public Json this[string index]
 {
     get
     {
         if (!childrens.ContainsKey(index))
         {
             childrens[index] = new Json();
         }
         childrenType = JSONChildrenType.DICTIONARY;
         return(childrens[index]);
     }
     set
     {
         childrens[index] = value;
         single_value     = "";
         childrenType     = JSONChildrenType.DICTIONARY;
     }
 }
Example #3
0
 public Json(object value)
 {
     single_value = value.ToString();
     childrenType = JSONChildrenType.STRING;
 }
Example #4
0
 public Json(bool value)
 {
     single_value = value.ToString();
     childrenType = JSONChildrenType.BOOLEAN;
 }
Example #5
0
 public Json(int value)
 {
     single_value = value.ToString();
     childrenType = JSONChildrenType.INT;
 }
Example #6
0
 public Json(double value)
 {
     single_value = value.ToString();
     childrenType = JSONChildrenType.DOUBLE;
 }
Example #7
0
 public Json(string value)
 {
     single_value = value;
     childrenType = JSONChildrenType.STRING;
 }
Example #8
0
 public Json()
 {
     childrenType = JSONChildrenType.NULL;
 }