- Home /
 
               Question by 
               RainaTaleth · Nov 06, 2016 at 06:55 PM · 
                c#unity 5json  
              
 
              Parsing multiple json files that are referencing each other
Hello all,
I am trying to figure out if it is possible to parse multiple json files that are referencing each other into C# class structure. 
 Example: 
Class json file
  {
        "wizard" : 
        {
           "type" : "ice",
           "spells" : ["ice_orb", "ice_storm"]
        }
     }
Spells json file:
 {
    "spells" : 
    {
       "ice_orb" : 
       {
          "damage" : 25,
          "cooldown" : 2
       }
    }
 }
Expected Result:
 public class RootObject
 {
     public Wizard wizard { get; set; }
 }
 
 public class Wizard
 {
     public string type { get; set; }
     public Dictionary<string, Spells> spells { get; set; }
 }
 
 public class RootObject
 {
     public Spells spells { get; set; }
 }
 
 public class Spells
 {
     public IceOrb ice_orb { get; set; }
 }
 
 public class IceOrb
 {
     public int damage { get; set; }
     public int cooldown { get; set; }
 }
 
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                