Class JsonExtensions
Inheritance
JsonExtensions
Assembly: Glitch9.IO.dll
Syntax
public static class JsonExtensions
Methods
|
Edit this page
View Source
AddIfNotFalse(JObject, string, bool, JsonSerializer)
Declaration
public static void AddIfNotFalse(this JObject jObject, string propertyName, bool value, JsonSerializer serializer)
Parameters
| Type |
Name |
Description |
| JObject |
jObject |
|
| string |
propertyName |
|
| bool |
value |
|
| JsonSerializer |
serializer |
|
|
Edit this page
View Source
AddIfNotNull<T>(JObject, string, T, JsonSerializer)
Declaration
public static void AddIfNotNull<T>(this JObject jObject, string propertyName, T value, JsonSerializer serializer)
Parameters
| Type |
Name |
Description |
| JObject |
jObject |
|
| string |
propertyName |
|
| T |
value |
|
| JsonSerializer |
serializer |
|
Type Parameters
|
Edit this page
View Source
AddIfNotNull<T>(JObject, string, T, JsonSerializer, JsonConverter)
Declaration
public static void AddIfNotNull<T>(this JObject jObject, string propertyName, T value, JsonSerializer serializer, JsonConverter converter)
Parameters
| Type |
Name |
Description |
| JObject |
jObject |
|
| string |
propertyName |
|
| T |
value |
|
| JsonSerializer |
serializer |
|
| JsonConverter |
converter |
|
Type Parameters
|
Edit this page
View Source
GetBool(JObject, string, bool)
Declaration
public static bool GetBool(this JObject obj, string key, bool fallback = false)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
| bool |
fallback |
|
Returns
|
Edit this page
View Source
GetEnum<TEnum>(JObject, string, bool, TEnum)
Declaration
public static TEnum GetEnum<TEnum>(this JObject obj, string key, bool ignoreCase, TEnum fallback = default) where TEnum : Enum
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
| bool |
ignoreCase |
|
| TEnum |
fallback |
|
Returns
Type Parameters
|
Edit this page
View Source
GetEnum<TEnum>(JObject, string, TEnum)
Declaration
public static TEnum GetEnum<TEnum>(this JObject obj, string key, TEnum fallback = default) where TEnum : Enum
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
| TEnum |
fallback |
|
Returns
Type Parameters
|
Edit this page
View Source
GetFloat(JObject, string, float)
Declaration
public static float GetFloat(this JObject obj, string key, float fallback = 0)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
| float |
fallback |
|
Returns
|
Edit this page
View Source
GetInt(JObject, string, int)
Declaration
public static int GetInt(this JObject obj, string key, int fallback = 0)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
| int |
fallback |
|
Returns
|
Edit this page
View Source
GetKey<TKey>(JsonSerializer)
Declaration
public static TKey GetKey<TKey>(this JsonSerializer serializer)
Parameters
| Type |
Name |
Description |
| JsonSerializer |
serializer |
|
Returns
Type Parameters
|
Edit this page
View Source
GetLong(JObject, string, long)
Declaration
public static long GetLong(this JObject obj, string key, long fallback = 0)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
| long |
fallback |
|
Returns
|
Edit this page
View Source
GetNullableBool(JObject, string)
Declaration
public static bool? GetNullableBool(this JObject obj, string key)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
Returns
|
Edit this page
View Source
GetNullableEnum<TEnum>(JObject, string)
Declaration
public static TEnum? GetNullableEnum<TEnum>(this JObject obj, string key) where TEnum : struct, Enum
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
Returns
Type Parameters
|
Edit this page
View Source
GetNullableFloat(JObject, string)
Declaration
public static float? GetNullableFloat(this JObject obj, string key)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
Returns
|
Edit this page
View Source
GetNullableInt(JObject, string)
Declaration
public static int? GetNullableInt(this JObject obj, string key)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
Returns
|
Edit this page
View Source
GetNullableLong(JObject, string)
Declaration
public static long? GetNullableLong(this JObject obj, string key)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
Returns
|
Edit this page
View Source
GetObject<T>(JObject, string, JsonSerializer, T)
Declaration
public static T GetObject<T>(this JObject obj, string key, JsonSerializer serializer, T fallback = default)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
| JsonSerializer |
serializer |
|
| T |
fallback |
|
Returns
Type Parameters
|
Edit this page
View Source
GetString(JObject, string, string)
Declaration
public static string GetString(this JObject obj, string key, string fallback = null)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
| string |
fallback |
|
Returns
|
Edit this page
View Source
GetToken(JObject, string)
Declaration
public static JToken GetToken(this JObject obj, string key)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
| string |
key |
|
Returns
|
Edit this page
View Source
RemoveNulls(JObject)
Declaration
public static void RemoveNulls(this JObject obj)
Parameters
| Type |
Name |
Description |
| JObject |
obj |
|
|
Edit this page
View Source
WriteIfNotNull<T>(JsonWriter, string, T, JsonSerializer)
Declaration
public static void WriteIfNotNull<T>(this JsonWriter writer, string propertyName, T value, JsonSerializer serializer)
Parameters
| Type |
Name |
Description |
| JsonWriter |
writer |
|
| string |
propertyName |
|
| T |
value |
|
| JsonSerializer |
serializer |
|
Type Parameters