I have the following json string:
{
"Orders": [{
"SubOrderNo": "0582715",
"ItemNo": "20415541",
"ItemType": "ART",
"ItemName": "Fish",
"TemplateName": "TP1234",
"ObjectType": "MPP",
"ObjectId": "PE1234",
"SalesStartDate": "2018-08-01",
"InfoText": "Some dummy text. This till be replaced later with some awesome text instead. Happy Fish!",
"Attachment": null,
"TemplateImage": null,
"ApprovedBy": "Me",
"ExpectedDeliveryDate": "2017-10-20",
"Context": null,
"TemplateDescription": null,
"ColorStatus": 0,
"spArticles": []
}],
"JsonOrders": null
}
I have validate this on json lint, so it's valid json.
I have the following code:
public static DataTable jsonStringToTable(string jsonContent)
{
DataTable dt = JsonConvert.DeserializeObject<DataTable>(jsonContent);
return dt;
}
When I run this, I get the error:
Unexpected JSON token when reading DataTable. Expected StartArray, got StartObject. Path '', line 1, position 1.
Anyone who can tell why I can't convert my json to datatable?