mirror of https://github.com/Squidex/squidex.git
5 changed files with 58 additions and 11 deletions
@ -0,0 +1,33 @@ |
|||||
|
// ==========================================================================
|
||||
|
// JsonExtension.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using Newtonsoft.Json.Linq; |
||||
|
|
||||
|
namespace Squidex.Infrastructure.Json |
||||
|
{ |
||||
|
public static class JsonExtension |
||||
|
{ |
||||
|
public static bool IsNull(this JToken token) |
||||
|
{ |
||||
|
if (token == null) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
if (token.Type == JTokenType.Null) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
if (token is JValue value) |
||||
|
{ |
||||
|
return value.Value == null; |
||||
|
} |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue