This guide provides a quick overview for getting started with theDocumentation Index
Fetch the complete documentation index at: https://nvd-54.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
JSONLoader document loader. For detailed documentation of all JSONLoader features and configurations head to the API reference.
- TODO: Add any other relevant links, like information about underlying API, etc.
概述
集成详情
| Class | Package | Local | Serializable | JS support |
|---|---|---|---|---|
JSONLoader | langchain-community | ✅ | ❌ | ✅ |
加载器特性
| Source | Document Lazy Loading | Native Async Support |
|---|---|---|
JSONLoader | ✅ | ❌ |
设置
To access JSON document loader you’ll need to install thelangchain-community integration package as well as the jq Python 包。
凭证
No credentials are required to use theJSONLoader class.
要启用模型调用的自动追踪,请设置你的 LangSmith API 密钥:
安装
Install langchain-community and jq:初始化
现在我们可以实例化模型对象并加载文档:- TODO: Update model instantiation with relevant params.
加载
惰性加载
Read from JSON lines file
If you want to load documents from a JSON Lines file, you passjson_lines=True
and specify jq_schema to extract page_content from a single JSON object.
Read specific content keys
Another option is to setjq_schema='.' and provide a content_key in order to only load specific content:
JSON file with jq schema content_key
To load documents from a JSON file using the content_key within the jq schema, set is_content_key_jq_parsable=True. Ensure that content_key is compatible and can be parsed using the jq schema.
Extracting metadata
Generally, we want to include metadata available in the JSON file into the documents that we create from the content. 以下demonstrates how metadata can be extracted using theJSONLoader.
There are some key changes to be noted. In the previous example where we didn’t collect the metadata, we managed to directly specify in the schema where the value for the page_content can be extracted from.
In this example, we have to tell the loader to iterate over the records in the messages field. The jq_schema then has to be .messages[]
This allows us to pass the records (dict) into the metadata_func that has to be implemented. The metadata_func is responsible for identifying which pieces of information in the record should be included in the metadata stored in the final Document object.
Additionally, we now have to explicitly specify in the loader, via the content_key argument, the key from the record where the value for the page_content needs to be extracted from.
API 参考
For detailed documentation of allJSONLoader features and configurations head to the API reference
通过 MCP 将这些文档连接到 Claude、VSCode 等工具以获取实时答案。

