Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* PersonajeResponse.cs */
- [Serializable]
- struct PersonajesResponse {
- public Personaje[] data;
- }
- /* Personaje.cs */
- [Serializable]
- struct Personaje {
- public Pelo pelo;
- public Ojos ojos;
- public Piel piel;
- }
- /* Pelo.cs */
- [Serializable]
- struct Pelo {
- public int id;
- public string color;
- }
- /* Ojos.cs */
- [Serializable]
- struct Ojos {
- public int id;
- public string color;
- }
- /* Piel */
- [Serializable]
- struct Piel {
- public int id;
- public string color;
- }
- var rawJson = @"{
- "data": [{
- "pelo": {
- "id": 1,
- "color": "#ff0",
- },
- "ojos": {
- "id": 1,
- "color": "#000",
- },
- "piel": {
- "id": 1,
- "color": #ffc",
- }
- }]
- }";
- var response = JsonUtility.FromJson<PersonajesResponse>(rawJson);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement