Cascade
Loading...
Searching...
No Matches
Buzzware.Cascade.CascadeJsonSerialization Class Reference

CascadeJsonSerialization handles JSON serialization and deserialization within the Cascade framework. Provides utilities to serialize and deserialize model objects while considering configurable options to ignore certain properties based on defined conditions. Implemented using System.Text.Json. More...

Public Member Functions

 CascadeJsonSerialization (Boolean ignoreUnderscoreProperties=true, Boolean ignoreAssociations=true)
 CascadeJsonSerialization Constructor.
ImmutableDictionary< string, object?> DeserializeImmutableDictionary (string source)
 Deserializes a JSON string into an immutable dictionary.
Dictionary< string, object?> DeserializeDictionaryOfNormalTypes (string source)
 Deserializes a JSON string into a dictionary of normal types ie int, string, bool, double Vs eg. the JsonEntity instances returned by System.Text.Json.
Dictionary< string, object?> DeserializeDictionaryOfNormalTypes (JsonElement source)
 Deserializes a JSON element into a dictionary of normal types ie int, string, bool, double Vs eg. the JsonEntity instances returned by System.Text.Json.
object DeserializeType (Type type, string source)
 Deserializes a JSON string into a specific object type.
object DeserializeType (Type type, JsonElement source)
 Deserializes a JSON element into a specific object type.
DeserializeType< T > (string? source)
 Deserializes a JSON string into a specific generic type.
DeserializeType< T > (JsonElement element)
 Deserializes a JSON element into a specific generic type.
JsonElement DeserializeElement (string? source)
 Deserializes a JSON string into a JsonElement.
IEnumerable< M > DeserializeEnumerable< M > (IEnumerable< JsonElement > elements)
 Deserializes an IEnumerable of JsonElements into a collection of type M.
string? Serialize (object value)
 Serializes an object into a JSON string.
JsonNode SerializeToNode (object value)
 Serializes an object into a JsonNode.
JsonElement SerializeToElement (object value)
 Serializes an object to a JsonElement.

Detailed Description

CascadeJsonSerialization handles JSON serialization and deserialization within the Cascade framework. Provides utilities to serialize and deserialize model objects while considering configurable options to ignore certain properties based on defined conditions. Implemented using System.Text.Json.

Constructor & Destructor Documentation

◆ CascadeJsonSerialization()

Buzzware.Cascade.CascadeJsonSerialization.CascadeJsonSerialization ( Boolean ignoreUnderscoreProperties = true,
Boolean ignoreAssociations = true )
inline

CascadeJsonSerialization Constructor.

Parameters
ignoreUnderscorePropertiesSpecifies whether properties starting with an underscore should be ignored during serialization.
ignoreAssociationsSpecifies whether association properties should be ignored during serialization.

Member Function Documentation

◆ DeserializeDictionaryOfNormalTypes() [1/2]

Dictionary< string, object?> Buzzware.Cascade.CascadeJsonSerialization.DeserializeDictionaryOfNormalTypes ( JsonElement source)
inline

Deserializes a JSON element into a dictionary of normal types ie int, string, bool, double Vs eg. the JsonEntity instances returned by System.Text.Json.

Parameters
sourceThe JSON element to be deserialized.
Returns
A dictionary of string keys and object values.

◆ DeserializeDictionaryOfNormalTypes() [2/2]

Dictionary< string, object?> Buzzware.Cascade.CascadeJsonSerialization.DeserializeDictionaryOfNormalTypes ( string source)
inline

Deserializes a JSON string into a dictionary of normal types ie int, string, bool, double Vs eg. the JsonEntity instances returned by System.Text.Json.

Parameters
sourceThe JSON string to be deserialized.
Returns
A dictionary of string keys and object values.

◆ DeserializeElement()

JsonElement Buzzware.Cascade.CascadeJsonSerialization.DeserializeElement ( string? source)
inline

Deserializes a JSON string into a JsonElement.

Parameters
sourceThe JSON string to be deserialized.
Returns
A JsonElement representing the deserialized JSON.

◆ DeserializeEnumerable< M >()

IEnumerable< M > Buzzware.Cascade.CascadeJsonSerialization.DeserializeEnumerable< M > ( IEnumerable< JsonElement > elements)
inline

Deserializes an IEnumerable of JsonElements into a collection of type M.

Template Parameters
MThe type of objects to be deserialized into, constrained to class types.
Parameters
elementsThe collection of JsonElements to be deserialized.
Returns
An IEnumerable of deserialized type M objects.
Type Constraints
M :class 

◆ DeserializeImmutableDictionary()

ImmutableDictionary< string, object?> Buzzware.Cascade.CascadeJsonSerialization.DeserializeImmutableDictionary ( string source)
inline

Deserializes a JSON string into an immutable dictionary.

Parameters
sourceThe JSON string to be deserialized.
Returns
An immutable dictionary of string keys and object values.

◆ DeserializeType() [1/2]

object Buzzware.Cascade.CascadeJsonSerialization.DeserializeType ( Type type,
JsonElement source )
inline

Deserializes a JSON element into a specific object type.

Parameters
typeThe Type into which the JSON should be deserialized.
sourceThe JSON element to be deserialized.
Returns
The deserialized object of specified type.

◆ DeserializeType() [2/2]

object Buzzware.Cascade.CascadeJsonSerialization.DeserializeType ( Type type,
string source )
inline

Deserializes a JSON string into a specific object type.

Parameters
typeThe Type into which the JSON should be deserialized.
sourceThe JSON string to be deserialized.
Returns
The deserialized object of specified type.

◆ DeserializeType< T >() [1/2]

T Buzzware.Cascade.CascadeJsonSerialization.DeserializeType< T > ( JsonElement element)
inline

Deserializes a JSON element into a specific generic type.

Template Parameters
TThe type into which the JSON should be deserialized.
Parameters
elementThe JSON element to be deserialized.
Returns
The deserialized object of type T.

◆ DeserializeType< T >() [2/2]

Deserializes a JSON string into a specific generic type.

Template Parameters
TThe type into which the JSON should be deserialized.
Parameters
sourceThe JSON string to be deserialized.
Returns
The deserialized object of type T.

◆ Serialize()

string? Buzzware.Cascade.CascadeJsonSerialization.Serialize ( object value)
inline

Serializes an object into a JSON string.

Parameters
valueThe object to be serialized.
Returns
A JSON string representation of the object.

◆ SerializeToElement()

JsonElement Buzzware.Cascade.CascadeJsonSerialization.SerializeToElement ( object value)
inline

Serializes an object to a JsonElement.

Parameters
valueThe object to be serialized.
Returns
A JsonElement representing the serialized object.

◆ SerializeToNode()

JsonNode Buzzware.Cascade.CascadeJsonSerialization.SerializeToNode ( object value)
inline

Serializes an object into a JsonNode.

Parameters
valueThe object to be serialized.
Returns
A JsonNode representing the serialized object.

The documentation for this class was generated from the following file:
  • Buzzware.Cascade/utilities/CascadeJsonSerialization.cs