Skip to content

GoogleJson

Namespace: Vercel.AI.Google

public static class GoogleJson

JSON settings shared by Gemini request builders.

Inheritance: object

View source

public static JsonSerializerOptions Metadata { get; }

Serializes metadata and keeps explicit nulls.

Value: JsonSerializerOptions

View source

public static JsonSerializerOptions Options { get; }

Serializes like JSON.stringify: no null properties, and non-ASCII characters stay unescaped.

Value: JsonSerializerOptions

View source

public static JsonNode? Clone(JsonElement? element)

Clones a JSON element into a node.

Parameters

Name Type Description
element JsonElement?

Returns: JsonNode

View source

public static JsonObject ParseObject(string? json)

Parses a JSON object, or returns an empty object.

Parameters

Name Type Description
json string

Returns: JsonObject

View source

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?

View source

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?

View source

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?

View source

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

View source

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

View source

public static string? String(JsonElement element, string name)

Reads a string property.

Parameters

Name Type Description
element JsonElement
name string

Returns: string

View source

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

View source

public static string Write(JsonNode node)

Writes a node with Options.

Parameters

Name Type Description
node JsonNode

Returns: string

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product