0
 
{
    "time": 1627277852344
}
My C#
public class EventNotification
{
    public long time { get; set; }
}

public class WebhookReceiver : IReceiveWebhook
{
    private readonly ApplicationDbContext context;

    public WebhookReceiver(DbContextOptions<ApplicationDbContext> options)
    {
        context = new ApplicationDbContext(options);
    }
    public async Task<string> Request(string requestBody)
    {
        string jsonFormatted = JValue.Parse(requestBody).ToString(Formatting.Indented);
        EventNotification eventNotification = JsonConvert.DeserializeObject<EventNotification>(jsonFormatted);
        context.EventNotifications.Add(eventNotification);
        await context.SaveChangesAsync();
    }
}

Thanks so much !!!!

How can i deserialize a unix timestamp (μs) to a DateTime from JSON and save it to database

0 Answers0