Skip to content

Commit fcab0b5

Browse files
committed
fix: When parameter "value" is json string, JsonParser should convert json string to Object directly.
Signed-off-by: bourne7 <[email protected]>
1 parent 1256eaf commit fcab0b5

File tree

1 file changed

+4
-0
lines changed
  • spring-ai-model/src/main/java/org/springframework/ai/util/json

1 file changed

+4
-0
lines changed

spring-ai-model/src/main/java/org/springframework/ai/util/json/JsonParser.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ else if (javaType.isEnum()) {
168168
return Enum.valueOf((Class<Enum>) javaType, value.toString());
169169
}
170170

171+
if (value instanceof String jsonString) {
172+
return JsonParser.fromJson(jsonString, javaType);
173+
}
174+
171175
String json = JsonParser.toJson(value);
172176
return JsonParser.fromJson(json, javaType);
173177
}

0 commit comments

Comments
 (0)