Rehaan Ahmed

Rehaan Ahmed

  • 1.5k
  • 98
  • 4.9k

Serialize and desirialize multiple JSON to C#

Jul 5 2018 1:31 AM
I have three txt files which contain the same Json data i want to read them all in c# class objects and overwrite all the objects from a textbox value in all the files at the same time
in short i have these fields common in all three text files
 
"org":
"raff":
"time":
 
i want store their values in the c# object class from all three files at a time and then overwrite the same object values supplied by a textbox value for all the attributes read by three different files
code to read single file data
 
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
{
_orderRequest = (OrderRequest)JsonReader.ReadRecord(fs, _recordManager, TicketingRecordNames.OrderRequest);
}
my object class
public class OrderRequest
{
public string org;
public string raff;
public string time;
public string user;
public OrderRequest _orderRequest;
}
FILE 1 data
{
"org":"OrgTest",
"raff":"Raffle1",
"time":"112828",
"user":"User1",
}
FILE 2 data
{
"org":"OrgTest",
"raff":"Raffle1",
"time":"112828",
"user":"User111",
}

Answers (2)