- Home /
Parsing JSON API link
hey hey hey, i want to know how to parse json data when i go to this url. so far i can debug all the date. i just want the name. how do i do this? =)
using UnityEngine.Networking;
using TMPro;
public class JSONCONTROLLER : MonoBehaviour
{
private string jsonURL = "https://randomuser.me/api";
private void Update(){
if(Input.GetMouseButtonDown(0))
{
StartCoroutine(GetData());
}
}
private IEnumerator GetData()
{
UnityWebRequest www = UnityWebRequest.Get(jsonURL);
yield return www.SendWebRequest();
if(www.isNetworkError || www.isHttpError) {
Debug.Log(www.error);
}
else{
Debug.Log("Nice");
Debug.Log(www.downloadHandler.text);
byte[] results = www.downloadHandler.data;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
deserialization JSON to C# 0 Answers
a live updating button panel? pulling from an external api? 0 Answers
Yelp API- Latitude/Longitude parameter problem {Key/Value} 2 Answers
deserialize a json web api on top of the class or inside the start function 0 Answers
Parse JSON Data with JSON Utility to Dictionary object 1 Answer