This page walks through a JSON or JSONL import end to end. The two formats share the same configuration shape and the same property semantics — the only difference is how the input file is laid out.
mode value | File layout |
|---|---|
json | A single top-level array of objects in one file. |
jsonl | One object per line (newline-delimited). |
Each object becomes one node or one edge. Object keys are the column / property names; values carry the data.
people.json — JSON array[ {"_id": "P001", "name": "Alice", "age": 30}, {"_id": "P002", "name": "Bob", "age": 25} ]
people.jsonl — one object per line{"_id": "P001", "name": "Alice", "age": 30} {"_id": "P002", "name": "Bob", "age": 25}
Edge files follow the same shape (use whichever format you prefer for the source file):
knows.json[ {"from_id": "P001", "to_id": "P002", "since": 2024}, {"from_id": "P002", "to_id": "P001", "since": 2025} ]
Place the files next to the importer, typically in a ./data subdirectory:
Directory layout. ├── gqldb-importer └── data/ ├── people.json # or people.jsonl └── knows.json # or knows.jsonl
Use -sample json or -sample jsonl to match your source format:
Bash./gqldb-importer -sample json # or: -sample jsonl
A file named import.sample.json.yml (or import.sample.jsonl.yml) will be created in the current directory. If the file already exists, it will be overwritten — rename it before editing so a re-run doesn't clobber your changes:
Bashmv import.sample.json.yml import.json.yml
Edit the renamed file to point at your data and target server. See the Import Configurations for every field; the only format-specific knob is mode itself (json or jsonl). JSON value-type behavior is covered below.
Bash./gqldb-importer -c import.json.yml
Unlike CSV, JSON values already carry a type — strings are strings, numbers are numbers, booleans are booleans — so type declarations under properties are needed only when you want a more specific GQLDB type than JSON can express natively. The common cases:
| You want | Declare under properties |
|---|---|
Distinguish int32 from int64 for an integer column | age: int32 |
Force a float to double (or vice-versa) | score: double |
Parse a string as a timestamp | created_at: timestamp |
| Rename or prefix the value | Use the list form (see Configuration Reference) |
If the JSON already has the right type and the column name matches, you can omit properties entirely.