Class JsonUtil_v0_3
java.lang.Object
org.a2aproject.sdk.compat03.json.JsonUtil_v0_3
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.gson.GsonPre-configuredGsoninstance for JSON operations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tstatic <T> Tstatic StringSerializes an object to a JSON string using Gson.static voidwriteJsonRpcId(com.google.gson.stream.JsonWriter out, @Nullable Object id) Writes a JSON-RPCidfield.
-
Field Details
-
OBJECT_MAPPER
public static final com.google.gson.Gson OBJECT_MAPPERPre-configuredGsoninstance for JSON operations.This mapper is configured with strict parsing mode and all necessary custom TypeAdapters for A2A Protocol types including polymorphic types, enums, and date/time types.
Used throughout the SDK for consistent JSON serialization and deserialization.
-
-
Constructor Details
-
JsonUtil_v0_3
public JsonUtil_v0_3()
-
-
Method Details
-
fromJson
- Throws:
JsonProcessingException_v0_3
-
fromJson
- Throws:
JsonProcessingException_v0_3
-
toJson
Serializes an object to a JSON string using Gson.This method uses the pre-configured
OBJECT_MAPPERto produce JSON representation of the provided object.- Parameters:
data- the object to serialize- Returns:
- JSON string representation of the object
- Throws:
JsonProcessingException_v0_3
-
writeJsonRpcId
public static void writeJsonRpcId(com.google.gson.stream.JsonWriter out, @Nullable Object id) throws IOException Writes a JSON-RPCidfield. Handles null, String, and Number values, preserving fractional precision for non-integer numeric IDs.- Throws:
IOException
-