コード例 #1
0
        public Dictionary <string, JsonSingleProtery2Value> OrdiaryDicToJsonDic(Dictionary <string, string> dic)
        {
            Dictionary <string, JsonSingleProtery2Value> dicRtn = new Dictionary <string, JsonSingleProtery2Value>();
            JsonSingleProtery2Value value = new JsonSingleProtery2Value();

            foreach (string key in dic.Keys)
            {
                value       = new JsonSingleProtery2Value();
                value.Key   = key;
                value.Value = dic[key];
                value.JType = JsonValueType.String;
                dicRtn.Add(key, value);
            }

            return(dicRtn);
        }
コード例 #2
0
        public string GetSingleJsonProperty2Value(JsonSingleProtery2Value value)
        {
            string strRtn   = string.Empty;
            string strValue = string.Empty;

            strRtn += "\"" + value.Key + "\"";
            strRtn += ":";
            if (value.JType == JsonValueType.String)
            {
                strValue = "\"" + value.Value + "\"";
            }
            else if (value.JType == JsonValueType.Boolean || value.JType == JsonValueType.Number || value.JType == JsonValueType.Array || value.JType == JsonValueType.Json)
            {
                strValue = value.Value;
            }
            strRtn += strValue;

            return(strRtn);
        }