mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-22 16:28:27 +02:00
Partial
This commit is contained in:
19
src/WireMock.Net/Util/JsonUtils.cs
Normal file
19
src/WireMock.Net/Util/JsonUtils.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace WireMock.Util
|
||||
{
|
||||
internal static class JsonUtils
|
||||
{
|
||||
public static T ParseJTokenToObject<T>(object value)
|
||||
{
|
||||
if (value == null)
|
||||
return default(T);
|
||||
|
||||
JToken token = value as JToken;
|
||||
if (token == null)
|
||||
return default(T);
|
||||
|
||||
return token.ToObject<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user