JsonParseResult
Namespace: Vercel.AI.ProviderUtils
public sealed class JsonParseResultSuccess or failure of a JSON parse, including the raw value when parsing succeeded.
Inheritance: object
Properties
Section titled “Properties”public Exception? Error { get; }Parse or validation error.
Value: Exception
RawValue
Section titled “RawValue”public JsonElement? RawValue { get; }Value before schema projection. Null when the text was not JSON.
Value: JsonElement?
Success
Section titled “Success”public bool Success { get; }True when parsing and schema checks succeeded.
Value: bool
public JsonElement? Value { get; }Projected value.
Value: JsonElement?
Methods
Section titled “Methods”Fail(Exception, JsonElement?)
Section titled “Fail(Exception, JsonElement?)”public static JsonParseResult Fail(Exception error, JsonElement? rawValue)Creates a failure result.
Parameters
| Name | Type | Description |
|---|---|---|
error |
Exception | |
rawValue |
JsonElement? |
Returns: JsonParseResult
Ok(JsonElement, JsonElement)
Section titled “Ok(JsonElement, JsonElement)”public static JsonParseResult Ok(JsonElement value, JsonElement rawValue)Creates a success result.
Parameters
| Name | Type | Description |
|---|---|---|
value |
JsonElement | |
rawValue |
JsonElement |
Returns: JsonParseResult
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product