Skip to main content

Definition

Assembly: CloudNimble.ClaudeEssentials.dll Namespace: CloudNimble.ClaudeEssentials.Hooks Inheritance: System.Object

Syntax

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 own JsonSerializerContext:

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

Returns

Type: CloudNimble.ClaudeEssentials.Hooks.Inputs.NotificationHookInput? The deserialized hook input, or null if deserialization fails.

DeserializePermissionRequestInput

Deserializes a JSON string to a PermissionRequestHookInput1` with dynamic tool input.

Syntax

Parameters

Returns

Type: CloudNimble.ClaudeEssentials.Hooks.Inputs.PermissionRequestHookInput<object>? The deserialized hook input, or null if deserialization fails.

DeserializePostToolUseInput

Deserializes a JSON string to a PostToolUseHookInput2` with dynamic types.

Syntax

Parameters

Returns

Type: CloudNimble.ClaudeEssentials.Hooks.Inputs.PostToolUseHookInput<object, object>? The deserialized hook input, or null if deserialization fails.

DeserializePostToolUseInput

Deserializes a JSON string to a PostToolUseHookInput2` with specific types.

Syntax

Parameters

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

Returns

Type: CloudNimble.ClaudeEssentials.Hooks.Inputs.PreCompactHookInput? The deserialized hook input, or null if deserialization fails.

DeserializePreToolUseInput

Deserializes a JSON string to a PreToolUseHookInput1` with dynamic tool input.

Syntax

Parameters

Returns

Type: CloudNimble.ClaudeEssentials.Hooks.Inputs.PreToolUseHookInput<object>? The deserialized hook input, or null if deserialization fails.

DeserializePreToolUseInput

Deserializes a JSON string to a PreToolUseHookInput1` with a specific tool input type.

Syntax

Parameters

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

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

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

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

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

Returns

Type: CloudNimble.ClaudeEssentials.Hooks.Inputs.UserPromptSubmitHookInput? The deserialized hook input, or null if deserialization fails.

SerializeNotificationOutput

Serializes a NotificationHookOutput to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

SerializePermissionRequestOutput

Serializes a PermissionRequestHookOutput1` with dynamic tool input to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

SerializePostToolUseOutput

Serializes a PostToolUseHookOutput to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

SerializePreCompactOutput

Serializes a PreCompactHookOutput to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

SerializePreToolUseOutput

Serializes a PreToolUseHookOutput1` with dynamic tool input to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

SerializePreToolUseOutput

Serializes a PreToolUseHookOutput1` with a specific tool input type to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

Type Parameters

  • TToolInput - The type of the tool input.

SerializeSessionEndOutput

Serializes a SessionEndHookOutput to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

SerializeSessionStartOutput

Serializes a SessionStartHookOutput to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

SerializeStopOutput

Serializes a StopHookOutput to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

SerializeSubagentStopOutput

Serializes a SubagentStopHookOutput to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.

SerializeUserPromptSubmitOutput

Serializes a UserPromptSubmitHookOutput to JSON.

Syntax

Parameters

Returns

Type: string The JSON string representation.