- Home /
deserialization JSON to C#
I used object like a associative array, and i want to deserialize this to C#.
JSON look that:
{
room1: Room {
id: 'yKLeEDuSY',
roomName: 'room1',
},
room2: Room {
id: 'xIZQ-PKDo',
roomName: 'room2',
}
}
And i will have more rooms. With normal array i used
Rooms roomList= JsonUtility.FromJson<Rooms>(E.data.ToString());
Where Rooms:
public class Rooms
{
public Room[] rooms;
}
and Room:
public class Room
{
public string id;
public string roomName;
}
the key will be random name, and i dont know how to deserialize this.
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
json string parse to c# 0 Answers
JsonUtility serializes floats with way too many digits 2 Answers
decode json response 1 Answer