I have a Json file that looks like this
{
"itemDetails": [
{
"quantity": 2,
"name": "1 Hour Massage",
"description": null,
"code": null,
"price": 44.99,
"value": 49.99,
"expiresOn": null,
"expiresInMonths": null,
"overrideExpiry": false,
"sku": "",
"id": null
}
],
"purchaserEmail": "jane@example.com",
"purchaserName": "Jane Smith",
"recipientDetails": {
"recipientName": "Tommy Smith",
"recipientEmail": "tommy@example.com",
"message": "Happy Holidays!",
"scheduledFor": "2020-12-25T00:00:00"
},
"disableAllEmails": null,
"orderDate": null
}
how would i go about dezerializing this Json i have tried making objects for the arrays like this
namespace Api
{
class Order
{
ItemDetails [] itemDetails { get; set; }
string purchaserEmail { get; set; }
string purchaserName { get; set; }
bool disableAllEmails { get; set; }
string orderDate { get; set; }
}
and like this
using System;
using System.Collections.Generic;
using System.Text;
namespace Api
{
class ItemDetails
{
int quantity {get; set;}
string name{get; set;}
string description { get; set; }
string code { get; set; }
double price { get; set; }
double value { get; set; }
string expiresOn { get; set; }
string expiresInMonths { get; set; }
bool overrideExpiry { get; set; }
string sku { get; set; }
string id { get; set; }
}
}
but this does not work??? how would i do this the biggest problem for me is the array cuz the rest i get it's just that i can't reach the data of the aray Is there a way to use ReadAsASync to do this?