NullReferenceException: Object reference not set to an instance of an object Unity5 c#

Im making a inventory and ran into this i have no clue how to fix it.

using UnityEngine;
using System.Collections;
using LitJson;
using System.Collections.Generic;
using System.IO;

public class ItemDatabase : MonoBehaviour {
private List database = new List();
private JsonData itemData;

void Start()
{//finds file with json code
    itemData = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/Script/StreamingAssets/Items.json"));
    ConstructItemDatabase();

    Debug.Log(FetchItemByID(0).Description);

}
//gets asked item of i reyurn if not there
public Item FetchItemByID(int id)
{
    for (int i = 0; i < itemData.Count; i++)  //where NullReferenceException: Object reference not set to an instance of an object is
    {   if(database*.ID == id)*

{
return database*;*
}

}
return null;
}
//looks into json code
void ConstructItemDatabase()
{
for (int i = 0; i < itemData.Count; i++)
{
database.Add(new Item((int)(itemData[“id”]), itemData[“title”].ToString(), (int)(itemData_[“value”]), (int)(itemData*[“stats”][“power”]),
(int)(itemData[“stats”][“defence”]), (int)(itemData[“stats”][“vitality”]), itemData[“description”].ToString(), (bool)itemData[ “stackable” ],
(int)(itemData[“rarity”]), itemData[“slug”].ToString()));
}
}
}
//gets json code turns into c# class*

public class Item
{
public int ID { get; set; }
public string Title { get; set; }
public int Value { get; set; }
public int Power { get; set; }
public int Defence { get; set; }
public int Vitality { get; set; }
public string Description { get; set; }
public bool Stackable { get; set; }
public int Rarity { get; set; }
public string Slug { get; set; }
//turns json code into unity c#
public Item(int id, string title, int value, int power, int defence, int vitality, string description, bool stackable, int rarity, string slug)
{
this.ID = id;
this.Title = title;
this.Value = value;
this.Power = power;
this.Defence = defence;
this.Vitality = vitality;
this.Description = description;
this.Stackable = stackable;
this.Rarity = rarity;
this.Slug = slug;
}_

//fail safe
public Item()
{
this.ID = -1;
}
}//end
------------------------------------------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Inventory : MonoBehaviour {
GameObject inventoryPanel;
GameObject slotPanel;
ItemDatabase itemdatabase;
public GameObject inventorySlot;
public GameObject inventoeyItem;
private int slotAmount;
public List items = new List();
public List slots = new List();
void Start()
{
itemdatabase = GetComponent();
slotAmount = 18;
inventoryPanel = GameObject.Find(“InventoryPanel”);
slotPanel = inventoryPanel.transform.FindChild(“SlotPanel”).gameObject;
for (int i = 0; i < slotAmount; i++)
{
items.Add(new Item());
slots.Add(Instantiate(inventorySlot));
slots*.transform.SetParent(slotPanel.transform);*
}
AddItem(0);
}

public void AddItem(int id)
{
Item itemToAdd = itemdatabase.FetchItemByID(id);
for (int i = 0; i < items.Count; i++)
{
if(items*.ID == -1)*
{
items = itemToAdd;
GameObject itemObject = Instantiate(inventoeyItem);
itemObject.transform.SetParent(slots*.transform);*
itemObject.transform.position = Vector2.zero;
}
}
}
}//end
------------------------------------------------------------------------------------------------------------------------------------------------------
[
{
“id”: 0,
“title”: “Steel Gloves”,
“value”: 6,
* “stats”:{*
* “power”: 1,*
* “defence”: 4,*
* “vitality”: 2*
* },*
* “description”: “Gloves made from steel.”,*
* “stackable”: false,*
* “rarity”: 2,*
* “slug”: “steel_gloves”
_},
{
“id”: 1,
“title”: “The Great Stick”,
“value”: 543,
“stats”:{
“power”: 54,
“defence”: 2,
“vitality”: 54*

* },
“description”: “It’s a stick That’s pretty great.”,
“stackable”: true,
“rarity”: 6,_

“slug”: “the_great_stick”
_}
]*_

I don’t know if you are still having issues with this, but I came across this post having had a similar problem myself. It turned out for me that the issue was the order in which unity was trying to instantiate the objects.

You are reading the Json and creating your item database in the Start method of your ItemDatabase class script, and in the start method of your Inventory class you are calling the method to return that database, but since you are not sure which Start method unity is calling first, it could be that the Inventory class is trying to get the database before it has been read in by the other class.

This was what happened to me, and I fixed it by changing the Start method in the JSON reading class to an Awake method to ensure that the JSON was being read first.
Later I changed so that the second class only tried to get the JSON data when it was first needed in the game (I was doing a dialogue system so when that NPC was first interacted with). That way you can be certain that the call to the first class won’t happen before the JSON is read.

Hope this helps