${iServer2_Entity_Title}

${iServer2_Entity_Description}

        /// <summary>${iServer2_Entity_method_FromJson_D}</summary>
        /// <param name="jsonObject">${iServer2_Entity_method_FromJson_param_jsonObject}</param>
        /// <returns>${iServer2_Entity_method_FromJson_return}</returns>
        public static Entity FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }

            Entity entity = new Entity();

            entity.ID = jsonObject["id"];

            entity.Shape = ServerGeometry.FromJson((JsonObject)jsonObject["shape"]);

            //fieldValue
            JsonArray jsonValue = (JsonArray)jsonObject["fieldValues"];
            if (jsonValue != null && jsonValue.Count > 0)
            {
                entity.FieldValues = new List<string>();
                for (int i = 0; i < jsonValue.Count; i++)
                {
                    entity.FieldValues.Add(jsonValue[i]);
                }
            }

            //fieldNames
            JsonArray jsonNames = (JsonArray)jsonObject["fieldNames"];
            if (jsonNames != null && jsonNames.Count > 0)
            {
                entity.FieldNames = new List<string>();
                for (int i = 0; i < jsonNames.Count; i++)
                {
                    entity.FieldNames.Add(jsonNames[i]);
                }
            }

            return entity;
        }
        internal static string ToJson(Entity entity)
        {
            if (entity == null)
            {
                return null;
            }
            string json = "[{";

            List<string> list = new List<string>();

            if (entity.FieldNames != null && entity.FieldNames.Count > 0)
            {
                List<string> temp = new List<string>();
                foreach (string fn in entity.FieldNames)
                {
                    temp.Add(string.Format("\"{0}\"", fn));
                }
                list.Add(string.Format("\"fieldNames\":[{0}]", string.Join(",", temp.ToArray())));
            }
            else
            {
                list.Add(string.Format("\"fieldNames\":null"));
            }

            if (entity.FieldValues != null && entity.FieldValues.Count > 0)
            {
                List<string> temp = new List<string>();
                foreach (string fv in entity.FieldValues)
                {
                    temp.Add(string.Format("\"{0}\"", fv));
                }
                list.Add(string.Format("\"fieldValues\":[{0}]", string.Join(",", temp.ToArray())));
            }
            else
            {
                list.Add(string.Format("\"fieldValues\":null"));
            }

            list.Add(string.Format("\"shape\":{0}", ServerGeometry.ToJson(entity.Shape)));
            list.Add(string.Format("\"id\":{0}", entity.ID));

            json += string.Join(",", list.ToArray());
            json += "}]";
            return json;
        }