title: How can you properly read JSONs in Unity?
body: <p>So, for my game I would like to be able to add new projectiles easily by reading a JSON file and it just isn't working for me. I've never really used JSON before so I'm new to it and I just keep confusing myself. Here is the code and an example of the JSON I'm working with (N.B. I'm working in C#):</p>
  <pre><code>public class JSONTest : MonoBehaviour {
  {
      [Serializable]
      public class Root
      {
          public Projectile[] proj;
      }
  
      [Serializable]
      public class Projectile {
          public int ID;
          public string name;
          public float velocity;
          public int bounces;
          public bool explosive;
      }
      public static Root JsonConvert(string Json)
      {
          return JsonUtility.FromJson&lt;Root&gt;(Json);
      }
  }
  
  // Start is called before the first frame update
  void Start()
  {
      string jsonString = File.ReadAllText(Application.dataPath + &quot;/JSON/Projectiles.json&quot;); //reads the file into string
      Debug.Log(jsonString);
      Root test = Projectile.JsonConvert(jsonString);
      Debug.Log(test.proj.Length);
  }
  </code></pre>
  <p>}</p>
  <p>JSON:</p>
  <pre><code>{
      &quot;Projectiles&quot;:[{    
          &quot;ID&quot;:1,
          &quot;name&quot;:&quot;Bullet&quot;,
          &quot;velocity&quot;:1.5,
          &quot;bounces&quot;:3,
          &quot;explosive&quot;:false
      }, {
          &quot;ID&quot;:2,
          &quot;name&quot;:&quot;Rocket&quot;,
          &quot;velocity&quot;:3,
          &quot;bounces&quot;:1,
          &quot;explosive&quot;:true
      }]
  }
  </code></pre>
  <p>Every time it runs, I get a NullReferenceException on the second Debug.Log().</p>
  <p>Any help would be greatly appreciated</p>