I have a json from Firebase DataSnapShot using GetRawJsonValue. I have trouble converting it into object using JsonUtility.FromJson>(myjsonfromGetRawJsonValue). The sample json is as following:-
{"-LRpiJg_RP2re3UY30fG":{"orderslist":[{"Name":"Velvet Cake","Price":"10.9","Qty":1},{"Name":"green tea cake","Price":"8.9","Qty":1},{"Name":"latte","Price":"9.9","Qty":2},{"Name":"americano","Price":"5.9","Qty":2}],"rest_id":"dessert_house","table_number":"123","take_away":false,"user_id":"null"}, "-LRpjHchYhXTa0vY51JX":{"orderslist":[{"Name":"Velvet Cake","Price":10.899999618530273,"Qty":2},{"Name":"green tea cake","Price":8.8999996185302734,"Qty":1},{"Name":"latte","Price":9.8999996185302734,"Qty":2}],"rest_id":"dessert_house","table_number":"123","take_away":false,"user_id":"null"},"-LRplEOFsZ2j3A-aQYT4":{"orderslist":[{"Name":"Velvet Cake","Price":10.9,"Qty":1},{"Name":"latte","Price":9.9,"Qty":2},{"Name":"americano","Price":5.9,"Qty":1}],"rest_id":"dessert_house","table_number":"123","take_away":false,"user_id":"null"}
The serializable:-
[Serializable]
public class Orderslist
{
[SerializeField]
public string Name;
public double Price;
public int Qty;
}
[Serializable]
public class Orders
{
[SerializeField]
public string user_id;
public string rest_id;
public string date_time;
public bool take_away;
public string table_number;
public List<Orderslist> orderslist;
And how to access the children since the object child is System.String using Dictionary?