Skip to content

TryDeserialize Method ​

Definition ​

  • Namespace: JASE.Serializers
  • Assembly: JASE.Serializers.dll

Overloads ​

NameDescription
bool TryDeserialize(ReadOnlySpan<byte> json, out T output, JsonSerializerOptions options = null)Attempts to deserialize JSON bytes into a T without throwing.
bool TryDeserialize(string json, out T output, JsonSerializerOptions options = null)Attempts to deserialize JSON into a T without throwing.
bool TryDeserialize(byte[] json, Type type, out object output, JsonSerializerOptions options = null)Deserialize a JSON string into an object type
bool TryDeserialize(string json, Type type, out object output, JsonSerializerOptions options = null)Deserialize a JSON string into an object type

bool TryDeserialize(byte[] json, Type type, out object output, JsonSerializerOptions options = null) ​

csharp
bool TryDeserialize(byte[] json, Type type, out object output, JsonSerializerOptions options = null)

Deserialize a JSON string into an object type

Returns ​

Object

bool TryDeserialize(string json, Type type, out object output, JsonSerializerOptions options = null) ​

csharp
bool TryDeserialize(string json, Type type, out object output, JsonSerializerOptions options = null)

Deserialize a JSON string into an object type

Returns ​

Object

bool TryDeserialize(ReadOnlySpan<byte> json, out T output, JsonSerializerOptions options = null) ​

csharp
bool TryDeserialize(ReadOnlySpan<byte> json, out T output, JsonSerializerOptions options = null)

Attempts to deserialize JSON bytes into a T without throwing.

Parameters ​

NameDescription
jsonThe JSON byte array to parse. If null/empty, returns false.
optionsOptional JsonSerializerOptions; if null, uses library defaults.
outputThe deserialized value when the method returns true; otherwise the default for T.

Returns ​

true on success; otherwise false.

bool TryDeserialize(string json, out T output, JsonSerializerOptions options = null) ​

csharp
bool TryDeserialize(string json, out T output, JsonSerializerOptions options = null)

Attempts to deserialize JSON into a T without throwing.

Parameters ​

NameDescription
jsonThe JSON string to parse. If null/empty, returns false.
optionsOptional JsonSerializerOptions; if null, uses library defaults.
outputThe deserialized value when the method returns true; otherwise the default for T.

Returns ​

true on success; otherwise false.