GoogleJson
Namespace: Vercel.AI.Google
public static class GoogleJsonJSON settings shared by Gemini request builders.
Inheritance: object
Properties
Section titled “Properties”Metadata
Section titled “Metadata”public static JsonSerializerOptions Metadata { get; }Serializes metadata and keeps explicit nulls.
Value: JsonSerializerOptions
Options
Section titled “Options”public static JsonSerializerOptions Options { get; }Serializes like JSON.stringify: no null properties, and non-ASCII characters stay unescaped.
Value: JsonSerializerOptions
Methods
Section titled “Methods”Clone(JsonElement?)
Section titled “Clone(JsonElement?)”public static JsonNode? Clone(JsonElement? element)Clones a JSON element into a node.
Parameters
| Name | Type | Description |
|---|---|---|
element |
JsonElement? |
Returns: JsonNode
ParseObject(string?)
Section titled “ParseObject(string?)”public static JsonObject ParseObject(string? json)Parses a JSON object, or returns an empty object.
Parameters
| Name | Type | Description |
|---|---|---|
json |
string |
Returns: JsonObject
Set(JsonObject, string, bool?)
Section titled “Set(JsonObject, string, bool?)”public static void Set(JsonObject target, string name, bool? value)Assigns a boolean when it is present.
Parameters
| Name | Type | Description |
|---|---|---|
target |
JsonObject | |
name |
string | |
value |
bool? |
Set(JsonObject, string, double?)
Section titled “Set(JsonObject, string, double?)”public static void Set(JsonObject target, string name, double? value)Assigns a number when it is present.
Parameters
| Name | Type | Description |
|---|---|---|
target |
JsonObject | |
name |
string | |
value |
double? |
Set(JsonObject, string, int?)
Section titled “Set(JsonObject, string, int?)”public static void Set(JsonObject target, string name, int? value)Assigns an integer when it is present.
Parameters
| Name | Type | Description |
|---|---|---|
target |
JsonObject | |
name |
string | |
value |
int? |
Set(JsonObject, string, string?)
Section titled “Set(JsonObject, string, string?)”public static void Set(JsonObject target, string name, string? value)Assigns a string when it is non-null.
Parameters
| Name | Type | Description |
|---|---|---|
target |
JsonObject | |
name |
string | |
value |
string |
Set(JsonObject, string, JsonNode?)
Section titled “Set(JsonObject, string, JsonNode?)”public static void Set(JsonObject target, string name, JsonNode? value)Assigns a property when the value is present.
Parameters
| Name | Type | Description |
|---|---|---|
target |
JsonObject | |
name |
string | |
value |
JsonNode |
String(JsonElement, string)
Section titled “String(JsonElement, string)”public static string? String(JsonElement element, string name)Reads a string property.
Parameters
| Name | Type | Description |
|---|---|---|
element |
JsonElement | |
name |
string |
Returns: string
TryObject(JsonElement, string, out JsonElement)
Section titled “TryObject(JsonElement, string, out JsonElement)”public static bool TryObject(JsonElement element, string name, out JsonElement value)Reads an object property.
Parameters
| Name | Type | Description |
|---|---|---|
element |
JsonElement | |
name |
string | |
value |
JsonElement |
Returns: bool
Write(JsonNode)
Section titled “Write(JsonNode)”public static string Write(JsonNode node)Writes a node with Options.
Parameters
| Name | Type | Description |
|---|---|---|
node |
JsonNode |
Returns: string
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product