Home > llm-ops > TypeChatJsonValidator > validate
TypeChatJsonValidator.validate() method
Parses and validates the given JSON string according to the associated TypeScript schema. Returns a Success<T>
object containing the parsed JSON object if validation was successful. Otherwise, returns an Error
object with a message
property that contains the TypeScript compiler diagnostics.
Signature:
typescript
validate(jsonText: string): Result<T>;
validate(jsonText: string): Result<T>;
Parameters
Parameter | Type | Description |
---|---|---|
jsonText | string | The JSON string to validate. |
Returns:
Result<T>
The parsed JSON object or the TypeScript compiler diagnostic messages.