private List <string> ComposeCandidate(string data) { List <string> candidates = new List <string>(); // empty list string value = data.Split(_Splitter, 2)[1]; value = value.Remove(value.Length - 2); if (value != "[]") { GoogleAutoCompleteAPI respose = JsonUtility.FromJson <GoogleAutoCompleteAPI>("{\"candidate\":" + value + "}"); foreach (string candidate in respose.candidate) { candidates.Add(candidate); } } return(candidates); }
private void ComposeCandidate(string value, string convertText) { Debug.Log(value); value = value.Split(splitter, 2)[1]; value = value.Remove(value.Length - 2); Debug.Log(value); if (value != "[]") { GoogleAutoCompleteAPI respose = JsonUtility.FromJson <GoogleAutoCompleteAPI>("{\"candidate\":" + value + "}"); foreach (string str in respose.candidate) { var item = Instantiate(prefab) as RectTransform; var text = item.GetComponentsInChildren <Text>(); text[0].text = str; item.SetParent(Content, false); } } }