We are using NewtwonSoft.json currently but need to move to System.Text.JSON for security reasons.
So we are new to System.Text.JSON and are having trouble reading the following JSON file.
Ideally we would like to read and eventually put each record in a separate row in a Grid with the ID, Name and ContractTypeID as Columns A, B and C. Prefer VB.net but googling has led us to believe VB.net is not supported much in System.Text.JSON. So C# will work. Appreciate any feed back that would get us going. We have tried using a practice C# Project but get error:
"System.Text.Json.JsonReaderException: ''0xEF' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0." at the line Reader.Read.
var fileName = @"D:\MyFile.json";
byte[] data = System.IO.File.ReadAllBytes(fileName);
Utf8JsonReader reader = new Utf8JsonReader(data);
while (reader.Read())
[
{
"ID": "001",
"Name": "INT SYS CO",
"ContractTypeID": "CPAF"
},
{
"ID": "002",
"Name": "PLT",
"ContractTypeID": "CPFF"
},
{
"ID": "003",
"Name": "SBAND",
"ContractTypeID": "CPIF"
},
{
"ID": "004",
"Name": "SE",
"ContractTypeID": "CPIF_PI"
},
{
"ID": "005",
"Name": "SPE",
"ContractTypeID": "FFP"
}
]