Hello, i use this code:
string input = @"{""first"": ""Foo"", ""last"": ""Bar""}";
var res = JsonUtility.FromJson<Dictionary<string, object>> (input)
But variable “res” is empty dictionary. What i do wrong ?
The same situation i have when i use this code:
Dictionary<string, object> tmpDict1 = new Dictionary<string, object> ();
tmpDict1.Add("first", "Foo");
Dictionary<string, object> tmpDict2 = new Dictionary<string, object> ();
tmpDict2.Add("second", "Joe");
List<Dictionary<string, object>> lst = new List<Dictionary<string, object>> ();
lst.Add (tmpDict1);
lst.Add (tmpDict2);
var res = JsonUtility.ToJson(lst);
The variable “res” is empty string like “{}”.
What is it ? Why is it ?