Class JsonNetDebug
Assembly: Glitch9.dll
Syntax
public static class JsonNetDebug
Methods
|
Edit this page
View Source
Deserialize(JObject, Type, JsonSerializer)
Declaration
public static object Deserialize(JObject jo, Type type, JsonSerializer serializer)
Parameters
| Type |
Name |
Description |
| JObject |
jo |
|
| Type |
type |
|
| JsonSerializer |
serializer |
|
Returns
|
Edit this page
View Source
DeserializeArray<T>(JArray, JsonSerializer)
Debug-deserialize an array where each element is isolated.
Elements that fail are skipped and logged.
This is slow; use only for debugging.
Declaration
public static List<T> DeserializeArray<T>(JArray array, JsonSerializer serializer) where T : class
Parameters
| Type |
Name |
Description |
| JArray |
array |
|
| JsonSerializer |
serializer |
|
Returns
Type Parameters
|
Edit this page
View Source
Deserialize<T>(JObject, JsonSerializer)
Debug-deserialize a JObject into an object with per-property isolation.
- Try normal deserialization first.
- If it fails, create an instance and apply properties one-by-one,
logging the property that fails to deserialize/set.
This is slow; use only for debugging.
Declaration
public static T Deserialize<T>(JObject jo, JsonSerializer serializer) where T : class
Parameters
| Type |
Name |
Description |
| JObject |
jo |
|
| JsonSerializer |
serializer |
|
Returns
Type Parameters
|
Edit this page
View Source
Deserialize<T>(string, JsonSerializerSettings)
Debug-deserialize a JObject into an object with per-property isolation.
- Try normal deserialization first.
- If it fails, create an instance and apply properties one-by-one,
logging the property that fails to deserialize/set.
This is slow; use only for debugging.
Declaration
public static T Deserialize<T>(string json, JsonSerializerSettings jss) where T : class
Parameters
| Type |
Name |
Description |
| string |
json |
|
| JsonSerializerSettings |
jss |
|
Returns
Type Parameters
|
Edit this page
View Source
Serialize(object, JsonSerializer)
Serialize an object to JObject with detailed error handling per property.
If a property fails to serialize, it is logged and set to null in the output.
This helps to identify problematic properties in complex objects.
Declaration
public static JObject Serialize(object data, JsonSerializer serializer)
Parameters
| Type |
Name |
Description |
| object |
data |
|
| JsonSerializer |
serializer |
|
Returns
|
Edit this page
View Source
SerializeArray<T>(IList<T>, JsonSerializer)
Serialize array with error handling for each element.
If an element fails to serialize, it is skipped and an error is logged.
This helps to identify and isolate problematic elements in large collections.
This is super slow so don't forget to replace with normal serialization after debugging.
Declaration
public static string SerializeArray<T>(IList<T> array, JsonSerializer serializer)
Parameters
| Type |
Name |
Description |
| IList<T> |
array |
|
| JsonSerializer |
serializer |
|
Returns
Type Parameters