Overview
The JSON Connector provides functionality to retrieve data from local JSONL files (JSON Lines format) and register them in the Fess index.
This feature requires the fess-ds-json plugin.
Prerequisites
Plugin installation is required
Access to JSON files is required
Understanding of JSON structure is necessary
Plugin Installation
Method 1: Place JAR file directly
Method 2: Install from admin console
Open “System” -> “Plugins”
Upload the JAR file
Restart Fess
Configuration
Configure in the admin console under “Crawler” -> “Data Store” -> “Create New”.
Basic Settings
| Item | Example |
|---|---|
| Name | Products JSON |
| Handler Name | JsonDataStore |
| Enabled | On |
Parameter Configuration
Local file:
Multiple files:
Directory:
Parameter List
| Parameter | Required | Description |
|---|---|---|
files | No | Path to the JSON file(s) to process (multiple paths allowed: comma-separated). Only files with a .json or .jsonl extension are processed. |
directories | No | Path to the directory containing JSON files (multiple paths allowed: comma-separated) |
fileEncoding | No | Character encoding (default: UTF-8) |
Warning
Either files or directories must be specified. If neither is specified (both are empty), a DataStoreException will be thrown. If both are specified, files takes precedence and directories is ignored.
Note
The parameter name uses camelCase: fileEncoding (not the snake_case form file_encoding).
Directory Behavior
When directories is specified, files directly inside each directory are processed according to the following rules.
Subdirectories are not traversed (no recursive search is performed).
Only files with a
.jsonor.jsonlextension are targeted (case-insensitive).Files are processed in ascending order of their last-modified timestamp.
Note
This connector targets only JSON files on the local filesystem. HTTP access and API authentication are not supported.
Script Configuration
The value of each field is assembled by referencing the fields of the JSON object. Top-level fields of a JSON object can be referenced directly inside scripts as variables without a prefix (no data. prefix is used).
Simple JSON object:
Nested JSON object (nested objects are referenced as maps):
Array element processing:
Available Fields
<field_name>- Reference a top-level field of the JSON object directly by name<parent>.<child>- Field of a nested object<array>[<index>]- Array element<array>.<method>- Array methods (join,collect,size, etc.)
Note
If a field name contains characters that are invalid as a Groovy identifier, such as spaces or hyphens, that field cannot be referenced directly as a variable name.
JSON Format Details
JSON File Format
The JSON Connector reads files in JSONL (JSON Lines) format. This format places one JSON object per line. Files are read line by line, and each line is parsed as an independent JSON object.
Note
Files with a .json extension are also processed, but their content must be in JSONL format (one object per line). Array-format JSON files ([{...}, {...}]) and pretty-printed JSON spanning multiple lines cannot be read directly. Please convert them to JSONL format.
JSONL format file:
Usage Examples
Product Catalog
Parameters:
Script:
Merging Multiple JSON Files
Parameters:
Script:
Troubleshooting
File Not Found
Symptom: The log outputs ... is not found. or Source file ... does not exist.
Checklist:
Verify the file path is correct
Verify the file exists
Verify the file extension is
.jsonor.jsonlVerify read permissions on the file
JSON Parse Error
Symptom: The log outputs Crawling Access Exception and JsonParseException or similar messages
When a line contains invalid content, only that line is skipped and recorded as a failed URL; the crawl itself continues from the next line.
Checklist:
Verify the JSON file is in the correct format (JSONL: one object per line):
Verify the character encoding is correct
Check that a single object is not split across multiple lines
Check for comments (comments are not allowed in standard JSON)
No Data Retrieved
Symptom: Crawl succeeds but item count is 0
Checklist:
Verify the JSON structure
Verify the script configuration is correct (check that field references do not use the
data.prefix)Verify field names are correct (including case sensitivity)
Check log messages for errors
Large JSON Files
Symptom: Out of memory or timeout
Files are read line by line, so the total file size does not directly affect memory usage. However, problems may occur when a single line (object) is extremely large or when the indexing load is high.
Solution:
Split the JSON file into multiple files
Increase the Fess heap size
Advanced Script Examples
Conditional Processing
Each field is evaluated as an independent expression. Use ternary operators for conditional values:
Joining Arrays
Setting Default Values
Date Formatting
Numeric Processing
Reference
Data Store Connector Overview - Data Store Connector Overview
CSV Connector - CSV Connector
Database Connector - Database Connector
Data Store Crawling - Data Store Configuration Guide