I just de-serialized your data using Newtonsoft.Json by copying the json you provided, create a new class file, deleted the class and used Visual Studio edit, Paste Special, Paste JSON as class then saved the file. For the json I placed the code into a file, read it back using File.ReadAllText which returns a string (equivalent to your data returned)
using System;
using System.IO;
using Newtonsoft.Json;
namespace Demo
{
public class JsonHelpers
{
public static TModel ReadJsonFromFile<TModel>(string fileName)
{
var model = default(TModel);
if (!File.Exists(fileName)) return model;
var json = File.ReadAllText(fileName);
model = JsonConvert.DeserializeObject<TModel>(json);
return model;
}
}
}
Then called as follows
var data = JsonHelpers.ReadJsonFromFile<Rootobject>("data1.json");
If using System.Text.Json the same will work
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
namespace JsonLibrary
{
public class JSonHelper
{
public static T DeserializeObject<T>(string json)
{
return JsonSerializer.Deserialize<T>(json);
}
}
}