We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1256eaf commit b7fd600Copy full SHA for b7fd600
spring-ai-model/src/main/java/org/springframework/ai/util/json/JsonParser.java
@@ -168,8 +168,21 @@ else if (javaType.isEnum()) {
168
return Enum.valueOf((Class<Enum>) javaType, value.toString());
169
}
170
171
- String json = JsonParser.toJson(value);
172
- return JsonParser.fromJson(json, javaType);
+ Object result = null;
+ if (value instanceof String jsonString) {
173
+ try {
174
+ result = JsonParser.fromJson(jsonString, javaType);
175
+ } catch (Exception e) {
176
+ // ignore
177
+ }
178
179
+
180
+ if (result == null) {
181
+ String json = JsonParser.toJson(value);
182
+ result = JsonParser.fromJson(json, javaType);
183
184
185
+ return result;
186
187
188
0 commit comments