json文件:
{
"startMenu":[
{
"1":
{
"SenceInfo":{"Pos":"1,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"Camera":{"Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"FishInfo":[
{"fishId":"1","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"2","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"3","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"}]
},
"2":
{
"SenceInfo":{"Pos":"2,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"Camera":{"Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"FishInfo":[
{"fishId":"1","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"2","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"3","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"}]
},
"3":
{
"SenceInfo":{"Pos":"3,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"Camera":{"Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"FishInfo":[
{"fishId":"1","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"2","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"3","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"}]
}
}
],
"mainMenu":[
{
"1":
{
"SenceInfo":{"Pos":"4,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"Camera":{"Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"FishInfo":[
{"fishId":"1","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"2","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"3","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"}]
},
"2":
{
"SenceInfo":{"Pos":"5,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"Camera":{"Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"FishInfo":[
{"fishId":"1","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"2","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"3","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"}]
},
"3":
{
"SenceInfo":{"Pos":"6,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"Camera":{"Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
"FishInfo":[
{"fishId":"1","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"2","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"},
{"fishId":"3","fishName":"qwe","Pos":"0,0,0","Rotation":"0,0,0","Scale":"1,1,1"}]
}
}
]
}
JsonData data=JsonMapper.ToObject(jsonData);
for(int i=0;i<data.Count;i++)
{
for(int j=0;j<data[i].Count;j++)
{
for(int k=0;k<data[i][j].Count;k++)
{
print(data[1][0][0]["SenceInfo"]["Pos"]);
JsonData dataInfo=data[i][j][k];
}
}
}
unity3d LitJson 各种嵌套
最新推荐文章于 2023-08-30 14:30:12 发布