i am trying to read a large json file from c# and Deserialize it:
// deserialize JSON directly from a file
using (StreamReader file = File.OpenText(@"C:\Users\hansi\Desktop\csvjson.json"))
{
JsonSerializer serializer = new JsonSerializer();
Product product2 = (Product)serializer.Deserialize(file, typeof(Product));
Console.WriteLine(product2.Name);
}
But it only reads the first object and then close, anyone got answers to this? No Error the program continues, it just only reads the first object in my Json file
Example Json, it continues like this with 150000 products:
{
"Item No.": 1000,
"Product Name": "Pendant, Brass",
"Product Category": "Lig",
"Type": "Pendant",
"Collection": "Tynl",
"Designer": "Paav",
"Design": 1965,
"Form": "",
"Dimension": "",
"Finish of Main Part": "",
"New Arrival": "",
"Tags": "",
"Estimated Release Date": "Ready to Order",
"EAN": 571090274,
"Country": "",
"Country Of Origin": "CN",
"Custom Tariff Code": 940520,
"Product Weight /Kg": "3,3",
"Gross Weight /Kg": "5,1",
"Gross Height /Meter": "0,35",
"Gross Length /Meter": "0,53",
"Gross Depth /Meter": "0,53",
"Gross Volume /m3": "",
"Cord length": "",
"Max Watt": "",
"Upholstery": "",
"Price Group": "",
"Glides": "",
"EUR RRP.":
},
{