File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
plugin/src/main/java/org/opensearch/ml/utils Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -109,14 +109,13 @@ public static String processRemoteInferenceInputDataSetParametersValue(String in
109
109
if (value .isTextual ()) {
110
110
String textValue = value .asText ();
111
111
try {
112
- // Only try to parse as JSON if it looks like a JSON object or array
113
- if ((textValue .startsWith ("{" ) && textValue .endsWith ("}" ))
114
- || (textValue .startsWith ("[" ) && textValue .endsWith ("]" ))) {
115
- // Try to parse the string as JSON
116
- JsonNode parsedValue = mapper .readTree (textValue );
117
- // If successful, replace the string with the parsed JSON
112
+ // Try to parse the string as JSON
113
+ JsonNode parsedValue = mapper .readTree (textValue );
114
+ // Only replace if the parsed value is an object or array
115
+ if (parsedValue .isObject () || parsedValue .isArray ()) {
118
116
parametersNode .set (key , parsedValue );
119
117
} else {
118
+ // Leave it as-is if the parsed value is a primitive
120
119
parametersNode .set (key , value );
121
120
}
122
121
} catch (IOException e ) {
You can’t perform that action at this time.
0 commit comments