public bool TryParse <T>(ref T container) { JSONDecoder jd = RawValue.Clone(); try { IJSONable raw = (IJSONable)container; raw.fillFromJSON(jd); container = (T)raw; return(true); } catch (Exception) { return(false); } }
public void fillFromJSON(JSONDecoder jd) { jd.beginItem(); dataType = jd.getField()[1]; // dataType jd.getField(); // data jd.beginItem(); // [ Type t = Type.GetType(dataType); Queue <IJSONable> dataQ = new Queue <IJSONable>(); while (!jd.peekLine().Contains("]")) { IJSONable obj = (IJSONable)Activator.CreateInstance(t); obj.fillFromJSON(jd); dataQ.Enqueue(obj); } value = dataQ.ToArray(); jd.endItem(); jd.endItem(); }