Package org.springframework.ai.reader
Class JsonReader
java.lang.Object
org.springframework.ai.reader.JsonReader
- All Implemented Interfaces:
Supplier<List<Document>>
,DocumentReader
A class that reads JSON documents and converts them into a list of
Document
objects.- Since:
- 1.0.0
- Author:
- Mark Pollack, Christian Tzolov, rivkode rivkode
-
Constructor Summary
ConstructorDescriptionJsonReader
(org.springframework.core.io.Resource resource) JsonReader
(org.springframework.core.io.Resource resource, String... jsonKeysToUse) JsonReader
(org.springframework.core.io.Resource resource, JsonMetadataGenerator jsonMetadataGenerator, String... jsonKeysToUse) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.ai.document.DocumentReader
read
-
Constructor Details
-
JsonReader
public JsonReader(org.springframework.core.io.Resource resource) -
JsonReader
-
JsonReader
public JsonReader(org.springframework.core.io.Resource resource, JsonMetadataGenerator jsonMetadataGenerator, String... jsonKeysToUse)
-
-
Method Details
-
get
-
get
-
get
Retrieves documents from the JSON resource using a JSON Pointer.- Parameters:
pointer
- A JSON Pointer string (RFC 6901) to locate the desired element- Returns:
- A list of Documents parsed from the located JSON element
- Throws:
RuntimeException
- if the JSON cannot be parsed or the pointer is invalid
-