public override void fromJSONObject(JSONObject json) { List <JSONObject> ljo = json.list; if (this.l == null) { this.l = ScriptableObject.CreateInstance <IsoUnityList>(); } else { this.l.Clear(); } foreach (var jo in ljo) { JSONAble unserialized = JSONSerializer.UnSerialize(jo); this.l.Add(unserialized); } }
public void fromJSONObject(JSONObject json) { this.name = json["name"].ToString(); //Clean basic types destroyBasic(this.args); this.args = new Dictionary <string, object>(); JSONObject parameters = json["parameters"]; foreach (string key in parameters.keys) { JSONObject param = parameters[key]; JSONAble unserialized = JSONSerializer.UnSerialize(param); this.setParameter(key, unserialized); } }
/// <summary> /// JSon serialization things /// </summary> public JSONObject toJSONObject() { JSONObject json = new JSONObject(); json.AddField("name", name); JSONObject parameters = new JSONObject(); foreach (KeyValuePair <string, object> entry in args) { if (entry.Value is JSONAble) { var jsonAble = entry.Value as JSONAble; parameters.AddField(entry.Key, JSONSerializer.Serialize(jsonAble)); } else if (entry.Value is Object) { var o = entry.Value as Object; parameters.AddField(entry.Key, o.GetInstanceID()); } else { var val = IsoUnityTypeFactory.Instance.getIsoUnityType(entry.Value); if (val != null && val is JSONAble) { parameters.AddField(entry.Key, JSONSerializer.Serialize(val)); } else { parameters.AddField(entry.Key, entry.Value.ToString()); } } } json.AddField("parameters", parameters); return(json); }
/// <summary> /// JSon serialization things /// </summary> public JSONObject toJSONObject() { JSONObject json = new JSONObject(); json.AddField("name", name); JSONObject parameters = new JSONObject(); foreach (KeyValuePair <string, Object> entry in args) { if (entry.Value is JSONAble) { var jsonAble = entry.Value as JSONAble; parameters.AddField(entry.Key, JSONSerializer.Serialize(jsonAble)); } else { parameters.AddField(entry.Key, entry.Value.GetInstanceID()); } } json.AddField("parameters", parameters); return(json); }