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); }
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); }
public static string ToJson(this JsonObjectBase self) => JsonConvert.SerializeObject(self, Settings);
public static string Serialize <T>(this JsonObjectBase <T> obj) { return(JsonConvert.SerializeObject(obj, _jsonSerializerSettings)); }