I would recommend using Json.Net Schema framework. It lets you determine your own custom JSON schema that would fit your needs.
Please refer the following documentation that helps you on how to Load your schema. Once you have the schema determined you can validate it against a device template and confirm if it follows the same pattern.
You can then parse the JSON file using Json.Net to extract the data you may need. Here is sample of the code that extracts contents from a device template. I have used "RS40 Occupancy Sensor.json" device template in my case.
public static void LoadJson()
{
using (StreamReader r = new StreamReader(@"Path to your JSON device template file"))
{
string json = r.ReadToEnd();
try
{
dynamic? array = JsonConvert.DeserializeObject(json);
if (array != null)
{
foreach (var item in array)
{
var contents = item.contents;
//filter contents to get telemetry data or other information
}
}
}
catch (Exception ex) { Console.WriteLine(ex); }
}