IEnumerator GetJsonvalues()
{
string URLs = "http://www.json-generator.com/api/json/get/cfmxqecgky?indent=2";
WWW readjson = new WWW(URLs);
yield return readjson;
if(string.IsNullOrEmpty(readjson.error))
{
JSONDataString = readjson.text;
Jsondatasaver obj = JsonUtility.FromJson<Jsondatasaver>(JSONDataString);
Debug.Log("Total Pages " +obj.getdata[0]);
}
}
The above URL contains JSON data.I have done a similar one without any problem.For practise I just changed the URL and created a class with the names to call the JSON values using a POJO class.I have created a list to call the values inside a JSON array.So while calling obj.getdata[0].ANYVALUES I am getting arugument exception error.Cant undertsand why?
using System.Collections;
using System.Collections.Generic;
[System.Serializable]
public class Insidevalues
{
public string color;
public string pantone_value;
public int year;
public int id;
public string name;
public Insidevalues(string Color, string Pantone, int Year, int Id, string Name)
{
this.color = Color;
this.pantone_value = Pantone;
this.year = Year;
this.id = Id;
this.name = Name;
}
}
[System.Serializable]
public class Jsondatasaver
{
public int per_page;
public int total;
public int total_pages;
public int page;
public List<Insidevalues> getdata;
}