skip to Main Content

Json – Deserializing private members

I have the following code, taken from https://learn.microsoft.com/En-Us/dotnet/standard/serialization/system-text-json/custom-contracts#example-serialize-private-fields. It works fine to serialize the fields of Brains.Brain, but when deserializing, the instance created has (a, b, c, d) = (2, 0, 4, 4) when it should be (2, 3, 4,…

VIEW QUESTION

Facing issue while deserializing the jsonstring

I am trying to deserialize json string to datable and I am getting format error. string str = "{"Arg1":"Arg1Value","Arg2":"Arg2Value","DataArray":[{"Id": "2222","VehicleNo": "234354","Amount":"1000"},{"Id":"2226","VehicleNo":"2343","Amount":"2000"}]"}"; DataTable data = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(str); Error: Unexpected JSON token when reading DataTable. Expected StartArray, got StartObject. Path '', line 1,…

VIEW QUESTION
Back To Top
Search