ToJson() static private method

static private ToJson ( ThemeUnique themeUnique ) : string
themeUnique ThemeUnique
return string
        private static string GetThemeInfoJson(ThemeUnique themeUnique)
        {
            if (themeUnique == null)
            {
                return null;
            }

            string themeInfoJson = "{";
            List<string> themeInfoJsonList = new List<string>();

            if (themeUnique.Items != null && themeUnique.Items.Count > 0)
            {
                themeInfoJsonList.Add(string.Format("\"items\":[{0}]", GetThemeItemsJson(themeUnique.Items)));
            }
            else
            {
                themeInfoJsonList.Add("\"items\":[]");
            }

            if (!string.IsNullOrEmpty(themeUnique.UniqueExpression))
            {
                themeInfoJsonList.Add(string.Format("\"uniqueExpression\":\"{0}\"", themeUnique.UniqueExpression));
            }
            else
            {
                themeInfoJsonList.Add("\"uniqueExpression\":\"\"");
            }

            themeInfoJsonList.Add(string.Format("\"colorGradientType\":\"{0}\"", themeUnique.ColorGradientType.ToString()));

            if (themeUnique.DefaultStyle != null)
            {
                themeInfoJsonList.Add(string.Format("\"defaultStyle\":{0}", ServerStyle.ToJson(themeUnique.DefaultStyle)));
            }
            else
            {
                themeInfoJsonList.Add(string.Format("\"defaultStyle\":{0}", ServerStyle.ToJson(new ServerStyle())));
            }
            //添加专题图请求体必须的但不开放给用户的字段
            themeInfoJsonList.Add("\"type\":\"UNIQUE\"");
            if (themeUnique.MemoryData != null)
            {
                themeInfoJsonList.Add("\"memoryData\":" + themeUnique.ToJson(themeUnique.MemoryData));
            }
            else
            {
                themeInfoJsonList.Add("\"memoryData\":null");
            }
            themeInfoJson += string.Join(",", themeInfoJsonList.ToArray());
            themeInfoJson += "}";
            return themeInfoJson;
        }