Find Something in a JSON

I have a json file, which is an array of objects with a wide variety of values. Here is what one of the objects would look like:

            "Tag": "AST",
            "Name": "Asturias",
            "Full Name": "Kingdom of Asturias",
            "Religion": "Catholic",
            "Culture Group": "Iberian" ,
            "Ruler": "Alfonso III",
            "Govermnet Type": "Elective Monarchy",
            "Ruler Title": "King",
            "Sovereignty": "Independent",
            "Red": 0,
            "Green": 0,
            "Blue": 0

The last pieces of information, red, green, and blue represent how these objects, which are nations, appear on a map. I already have a code that, when an area is clicked, will use a raycast to determine the color of the clicked area, giving me a color 32 with the rgb color of that area. I’m now struggling with finding a way to use this color value to find the matching nation in the json, and from there determining other properties of the clicked nation, such as the name.

The red green and blue are empty here, because I hadn’t added these into this nation apparently, I only used this nation because it was the first on the list.

You need create a class with the parameters that you have in the JSON and the class need to be Serializable

public class MyJSON
         public string Tag;
         public string Name;
         public string Full Name;
         public string Religion;
         public string Culture Group;
         public string Ruler;
         public string Govermnet Type;
         public string Ruler Title;
         public string Sovereignty;
         public int Red;
         public int Green;
         public int Blue;

After that you only call the library JsonUtility from Unity Engine and the method FromJson(json);

GetDataFromJson(string jsonwithData)
   var DataFromJson = JsonUtility.FromJson<MyJSON>(jsonwithData);

   Debug.loog(DataFromJson.Red)   //  0
   Debug.loog(DataFromJson.Blue)   //  0
   Debug.loog(DataFromJson.Green)   //  0


if you are working with others JSON only be careful because JsonUtility don’t convert arrays and you can have a error