I have this json:
[ [ [ "Tel Aviv", "Beersheba", "Jerusalem", "Haifa" ] ], [ { "City": "Tel Aviv" }, { "City": "Beersheba" }, { "City": "Jerusalem" }, { "City": "Haifa" }, { "City": "Jerusalem" }, { "City": "Tel Aviv" }, { "City": "Haifa" }, { "City": "Beersheba" }, { "City": "Jerusalem" }, { "City": "Jerusalem" }, { "City": "Haifa" }, { "City": "Tel Aviv" }, { "City": "Tel Aviv" }, { "City": "Beersheba" } ] ]
And i converted it to a List:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Newtonsoft;
string jsonStr = "<json string from above>";
List<object> data;
private void Start()
{
data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(jsonStr);
Debug.Log(data[0,0]);
}
But when the dubugger got to "Debug.Log(data[0,0]);" it printed:
Severity Code Description Project File Line Suppression State Error CS0021 Cannot apply indexing with [] to an expression of type 'object' Assembly-CSharp C:\Users\cdi2\Downloads\mdClone-20180627T083334Z-001\mdClone\Assets\CreateTable.cs 31 Active