public void AddMessage(string jsonStr,byte[] data) { if (jsonStr.StartsWith("{") && jsonStr.EndsWith("}")) { Hashtable table = new Hashtable(); table = TinyJSON.jsonDecode(jsonStr) as Hashtable; Message myMessage = new Message(); myMessage.hashtable = table; myMessage.data = data; m_MyMessageControl.AddMessage(myMessage); } }
private IEnumerator LoadJsonCoroutine(string url, Action <Hashtable> callback) { WWW www = new WWW(url); yield return(www); if (www.error != null) { Debug.Log("加载JSON失败:" + www.error); } else { try { Hashtable data = TinyJSON.jsonDecode(www.text) as Hashtable; callback(data); } catch { Debug.Log("JSON格式错误"); } } www.Dispose(); }
public static Hashtable hashtableFromJson(this string json) { return(TinyJSON.jsonDecode(json) as Hashtable); }
public static ArrayList arrayListFromJson(this string json) { return(TinyJSON.jsonDecode(json) as ArrayList); }