Skip to content

Commit

Permalink
Merge pull request #934 from clement911/readding-remove-method
Browse files Browse the repository at this point in the history
Re-added removed method useful to deserialize webhook payload into ob…
  • Loading branch information
clement911 authored Oct 3, 2023
2 parents d139d78 + 86aa388 commit 0ad9cee
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ShopifySharp/Infrastructure/Serializer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ShopifySharp.Converters;
using System;
using System.Collections.Generic;

namespace ShopifySharp.Infrastructure
Expand Down Expand Up @@ -33,6 +34,13 @@ public static T Deserialize<T>(string json, string rootElementPath = null, DateP
return DeserializeWithNewtonsoft<T>(json, rootElementPath, dateParseHandlingOverride);
}

/// <remarks>This method is not used internally by ShopifySharp but can be used to deserialize webhook JSON payloads into objects</remarks>
public static object Deserialize(string json, Type objectType)
{
var settings = CreateNewtonsoftSettings();
return JsonConvert.DeserializeObject(json, objectType, settings);
}

private static T DeserializeWithNewtonsoft<T>(string json, string rootElementPath, DateParseHandling? dateParseHandlingOverride)
{
var settings = CreateNewtonsoftSettings();
Expand Down

0 comments on commit 0ad9cee

Please sign in to comment.