Class JsonUtils
java.lang.Object
org.springframework.ai.vectorstore.JsonUtils
Utility class for JSON processing. Provides methods for converting JSON strings to maps
and lists, and for converting between lists of different numeric types.
- Author:
- Christian Tzolov
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConverts a JSON string to a map.Converts a list of floats to a list of doubles.static float[]
toFloatArray
(List<Float> embedding) Converts a list of doubles to a float array.
-
Constructor Details
-
JsonUtils
public JsonUtils()
-
-
Method Details
-
jsonToMap
Converts a JSON string to a map.- Parameters:
jsonText
- the JSON string to convert- Returns:
- the map representation of the JSON string
- Throws:
RuntimeException
- if an error occurs during the conversion
-
toFloatArray
Converts a list of doubles to a float array.- Parameters:
embedding
- the list of doubles to convert- Returns:
- the float array
-
toDouble
Converts a list of floats to a list of doubles.- Parameters:
floats
- the list of floats to convert- Returns:
- the list of doubles
-