Exemplo n.º 1
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            JsonObjectBase obj = value as JsonObjectBase;

            if (obj?.JObject == null)
            {
                writer.WriteNull();
                return;
            }

            obj.JObject.WriteTo(writer);
        }
Exemplo n.º 2
0
        private object DeserializeListItem(PdListBase pd, JsonObjectBase jsonData)
        {
            object item = null;

            if (jsonData is JsonObjectSimple)
            {
                var jsonSimple = jsonData as JsonObjectSimple;

                if (jsonSimple.Value != null)
                {
                    item = pd.ItemFabric.StringToObject(jsonSimple.Value);
                }
            }
            else

            if (jsonData is JsonObjectClass)
            {
                var jsonClass = jsonData as JsonObjectClass;
                item = pd.ItemFabric.CreateInstance();
                Deserialize(item, jsonClass.Class);
            }

            return(item);
        }
Exemplo n.º 3
0
 public static string ToJson(this JsonObjectBase self) => JsonConvert.SerializeObject(self, Settings);
Exemplo n.º 4
0
 public static string Serialize <T>(this JsonObjectBase <T> obj)
 {
     return(JsonConvert.SerializeObject(obj, _jsonSerializerSettings));
 }