I am pulling twitter data via python from the Twitter API. It is pulling the data back and putting it in a text file. I want to use C# to parse the file but I am having some problems. I am using JsonSerializer to run through it. I have a separate class for the JSON items but as I am creating the class and going through the JSON file I have realized 2 things. Every field in the JSON file needs to be in the class and it needs to be in order. There are over 100 items in this one tweet and it looks like they are dynamic depending on the content. How can I parse the file easily without having to create 100 items in the Twitter class? Below are the code and sample data.
public class TwitterItems
{
}
static void Main(string[] args)
{
TwitterItems twitList = JsonConvert.DeserializeObject<TwitterItems>(File.ReadAllText(@"C:\Users\soliver\Documents\VS Code\twitter_test\tweets.txt"));
using (StreamReader file = File.OpenText(@"C:\Users\soliver\Documents\VS Code\twitter_test\tweets.txt"))
{
JsonSerializer serializer = new JsonSerializer();
TwitterItems twitListDeserialized = (TwitterItems)serializer.Deserialize(file, typeof(TwitterItems));
}
}