Definition
Assembly: CloudNimble.ClaudeEssentials.dll Namespace: CloudNimble.ClaudeEssentials.Hooks Inheritance: System.ObjectSyntax
Summary
Provides static helper methods for serializing and deserializing Claude Code hook types. All methods use the AOT-compatible ClaudeHooksJsonContext for serialization.Usage
ClaudeHooksSerializer provides AOT-compatible static methods for JSON serialization using source-generated contexts.
Deserializing Input
Serializing Output
Using Custom Types
For strongly-typed tool inputs, create your ownJsonSerializerContext:
Properties
DefaultOptions
Gets the default JsonSerializerOptions configured for Claude Code hooks. This instance is configured with the ClaudeHooksJsonContext for AOT compatibility.Syntax
Property Value
Type:System.Text.Json.JsonSerializerOptions
Methods
DeserializeNotificationInput
Deserializes a JSON string to a NotificationHookInput.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.NotificationHookInput?
The deserialized hook input, or null if deserialization fails.
DeserializePermissionRequestInput
Deserializes a JSON string to aPermissionRequestHookInput1` with dynamic tool input.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.PermissionRequestHookInput<object>?
The deserialized hook input, or null if deserialization fails.
DeserializePostToolUseInput
Deserializes a JSON string to aPostToolUseHookInput2` with dynamic types.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.PostToolUseHookInput<object, object>?
The deserialized hook input, or null if deserialization fails.
DeserializePostToolUseInput
Deserializes a JSON string to aPostToolUseHookInput2` with specific types.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
typeInfo | System.Text.Json.Serialization.Metadata.JsonTypeInfo<CloudNimble.ClaudeEssentials.Hooks.Inputs.PostToolUseHookInput<TToolInput, TToolResponse>> | The JSON type info for the specific input type. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.PostToolUseHookInput<TToolInput, TToolResponse>?
The deserialized hook input, or null if deserialization fails.
Type Parameters
TToolInput- The type of the tool input.TToolResponse- The type of the tool response.
DeserializePreCompactInput
Deserializes a JSON string to a PreCompactHookInput.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.PreCompactHookInput?
The deserialized hook input, or null if deserialization fails.
DeserializePreToolUseInput
Deserializes a JSON string to aPreToolUseHookInput1` with dynamic tool input.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.PreToolUseHookInput<object>?
The deserialized hook input, or null if deserialization fails.
DeserializePreToolUseInput
Deserializes a JSON string to aPreToolUseHookInput1` with a specific tool input type.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
typeInfo | System.Text.Json.Serialization.Metadata.JsonTypeInfo<CloudNimble.ClaudeEssentials.Hooks.Inputs.PreToolUseHookInput<TToolInput>> | The JSON type info for the specific input type. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.PreToolUseHookInput<TToolInput>?
The deserialized hook input, or null if deserialization fails.
Type Parameters
TToolInput- The type of the tool input.
DeserializeSessionEndInput
Deserializes a JSON string to a SessionEndHookInput.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.SessionEndHookInput?
The deserialized hook input, or null if deserialization fails.
DeserializeSessionStartInput
Deserializes a JSON string to a SessionStartHookInput.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.SessionStartHookInput?
The deserialized hook input, or null if deserialization fails.
DeserializeStopInput
Deserializes a JSON string to a StopHookInput.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.StopHookInput?
The deserialized hook input, or null if deserialization fails.
DeserializeSubagentStopInput
Deserializes a JSON string to a SubagentStopHookInput.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.SubagentStopHookInput?
The deserialized hook input, or null if deserialization fails.
DeserializeUserPromptSubmitInput
Deserializes a JSON string to a UserPromptSubmitHookInput.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
json | string | The JSON string to deserialize. |
Returns
Type:CloudNimble.ClaudeEssentials.Hooks.Inputs.UserPromptSubmitHookInput?
The deserialized hook input, or null if deserialization fails.
SerializeNotificationOutput
Serializes a NotificationHookOutput to JSON.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.NotificationHookOutput | The hook output to serialize. |
Returns
Type:string
The JSON string representation.
SerializePermissionRequestOutput
Serializes aPermissionRequestHookOutput1` with dynamic tool input to JSON.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.PermissionRequestHookOutput<object> | The hook output to serialize. |
Returns
Type:string
The JSON string representation.
SerializePostToolUseOutput
Serializes a PostToolUseHookOutput to JSON.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.PostToolUseHookOutput | The hook output to serialize. |
Returns
Type:string
The JSON string representation.
SerializePreCompactOutput
Serializes a PreCompactHookOutput to JSON.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.PreCompactHookOutput | The hook output to serialize. |
Returns
Type:string
The JSON string representation.
SerializePreToolUseOutput
Serializes aPreToolUseHookOutput1` with dynamic tool input to JSON.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.PreToolUseHookOutput<object> | The hook output to serialize. |
Returns
Type:string
The JSON string representation.
SerializePreToolUseOutput
Serializes aPreToolUseHookOutput1` with a specific tool input type to JSON.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.PreToolUseHookOutput<TToolInput> | The hook output to serialize. |
typeInfo | System.Text.Json.Serialization.Metadata.JsonTypeInfo<CloudNimble.ClaudeEssentials.Hooks.Outputs.PreToolUseHookOutput<TToolInput>> | The JSON type info for the specific output type. |
Returns
Type:string
The JSON string representation.
Type Parameters
TToolInput- The type of the tool input.
SerializeSessionEndOutput
Serializes a SessionEndHookOutput to JSON.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.SessionEndHookOutput | The hook output to serialize. |
Returns
Type:string
The JSON string representation.
SerializeSessionStartOutput
Serializes a SessionStartHookOutput to JSON.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.SessionStartHookOutput | The hook output to serialize. |
Returns
Type:string
The JSON string representation.
SerializeStopOutput
Serializes a StopHookOutput to JSON.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.StopHookOutput | The hook output to serialize. |
Returns
Type:string
The JSON string representation.
SerializeSubagentStopOutput
Serializes a SubagentStopHookOutput to JSON.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.SubagentStopHookOutput | The hook output to serialize. |
Returns
Type:string
The JSON string representation.
SerializeUserPromptSubmitOutput
Serializes a UserPromptSubmitHookOutput to JSON.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
output | CloudNimble.ClaudeEssentials.Hooks.Outputs.UserPromptSubmitHookOutput | The hook output to serialize. |
Returns
Type:string
The JSON string representation.