예제 #1
0
        private static string SerializeToJson(IEnumerable <CmdBase> data)
        {
            var jsonData = DataObjectJsonItem.Convert(data);

            if (jsonData == null)
            {
                return(null);
            }

            return(JsonConvert.SerializeObject(jsonData));
        }
예제 #2
0
        private static IEnumerable <CmdBase> DeserializeFromJson(string jsonSting)
        {
            if (jsonSting == null)
            {
                return(null);
            }
            var jsonData = JsonConvert.DeserializeObject <List <DataObjectJsonItem> >(jsonSting);

            if (jsonData == null)
            {
                return(null);
            }

            return(DataObjectJsonItem.Convert(jsonData));
        }