Package com.google.genai
Class JsonSerializable
java.lang.Object
com.google.genai.JsonSerializable
- Direct Known Subclasses:
Blob,Candidate,Citation,CitationMetadata,CodeExecutionResult,Content,ControlReferenceConfig,ControlReferenceImage,DynamicRetrievalConfig,ExecutableCode,FileData,FunctionCall,FunctionCallingConfig,FunctionDeclaration,FunctionResponse,GenerateContentConfig,GenerateContentParameters,GenerateContentResponse,GenerateContentResponsePromptFeedback,GenerateContentResponseUsageMetadata,GeneratedImage,GenerateImagesConfig,GenerateImagesParameters,GenerateImagesResponse,GenerationConfig,GenerationConfigRoutingConfig,GenerationConfigRoutingConfigAutoRoutingMode,GenerationConfigRoutingConfigManualRoutingMode,GoogleSearch,GoogleSearchRetrieval,GoogleTypeDate,GroundingChunk,GroundingChunkRetrievedContext,GroundingChunkWeb,GroundingMetadata,GroundingSupport,HttpOptions,Image,LogprobsResult,LogprobsResultCandidate,LogprobsResultTopCandidates,MaskReferenceConfig,MaskReferenceImage,Part,PrebuiltVoiceConfig,RawReferenceImage,ReplayFile,ReplayInteraction,ReplayRequest,ReplayResponse,Retrieval,RetrievalMetadata,SafetyRating,SafetySetting,Schema,SearchEntryPoint,Segment,SpeechConfig,StyleReferenceConfig,StyleReferenceImage,SubjectReferenceConfig,SubjectReferenceImage,TestTableFile,TestTableItem,ThinkingConfig,Tool,ToolCodeExecution,ToolConfig,UploadFileConfig,UpscaleImageAPIConfig,UpscaleImageAPIParameters,UpscaleImageConfig,UpscaleImageParameters,UpscaleImageResponse,VertexAISearch,VertexRagStore,VertexRagStoreRagResource,VideoMetadata,VoiceConfig
A class that can be serialized to JSON and deserialized from JSON.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final com.fasterxml.jackson.databind.ObjectMapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends JsonSerializable>
TfromJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> clazz) Deserializes a JsonNode to an object of the given type.static <T extends JsonSerializable>
TfromJsonString(String jsonString, Class<T> clazz) Deserializes a Json string to an object of the given type.toJson()Serializes the instance to a Json string.protected static com.fasterxml.jackson.databind.JsonNodetoJsonNode(Object object) Serializes an object to a JsonNode.protected static StringtoJsonString(Object object) Serializes an object to a Json string.
-
Field Details
-
objectMapper
protected static final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
JsonSerializable
public JsonSerializable()
-
-
Method Details
-
toJsonString
Serializes an object to a Json string. -
toJson
Serializes the instance to a Json string. -
toJsonNode
Serializes an object to a JsonNode. -
fromJsonString
Deserializes a Json string to an object of the given type. -
fromJsonNode
public static <T extends JsonSerializable> T fromJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> clazz) Deserializes a JsonNode to an object of the given type.
-