Class JsonDefaults
- Namespace
- JD.AI.Core.Infrastructure
- Assembly
- JD.AI.Core.dll
Canonical JSON serialization options. Use these instead of creating new JsonSerializerOptions instances throughout the codebase.
public static class JsonDefaults
- Inheritance
-
JsonDefaults
- Inherited Members
Properties
Compact
Compact options: camelCase, no indentation. Suitable for wire formats, storage, and contexts where size matters.
public static JsonSerializerOptions Compact { get; }
Property Value
Indented
Indented-only options: PascalCase (default), indented output. Suitable for tool output where property names should not be transformed.
public static JsonSerializerOptions Indented { get; }
Property Value
Options
Default options: camelCase, relaxed parsing, indented output. Suitable for tool output, user-facing JSON, and general use.
public static JsonSerializerOptions Options { get; }
Property Value
Strict
Strict options: PascalCase, no relaxation. Suitable for API contracts and formal serialization.
public static JsonSerializerOptions Strict { get; }
Property Value
Methods
Deserialize<T>(string)
Deserialize JSON using default options.
public static T? Deserialize<T>(string json)
Parameters
jsonstring
Returns
- T
Type Parameters
T
Deserialize<T>(JsonElement)
Deserialize a JSON element using default options.
public static T? Deserialize<T>(JsonElement element)
Parameters
elementJsonElement
Returns
- T
Type Parameters
T
SerializeCompact<T>(T)
Serialize an object using compact options.
public static string SerializeCompact<T>(T value)
Parameters
valueT
Returns
Type Parameters
T
Serialize<T>(T)
Serialize an object using default options.
public static string Serialize<T>(T value)
Parameters
valueT
Returns
Type Parameters
T