Skip to content

CSV & JSON Connectors

The CSV and JSON connectors enable bulk data import into the knowledge graph from structured files. Both support file upload and URL-based fetching, with automatic schema inference and configurable graph node generation.

CSV Connector

Configuration

File Upload

json
{
  "name": "Customer Data",
  "source_type": "csv",
  "config": {
    "file_path": "/data/customers.csv",
    "node_label": "Customer",
    "delimiter": ",",
    "has_header": true,
    "id_column": "customer_id"
  }
}

URL-Based

json
{
  "name": "Public Dataset",
  "source_type": "csv",
  "config": {
    "url": "https://data.example.com/exports/products.csv",
    "node_label": "Product",
    "delimiter": ",",
    "has_header": true,
    "id_column": "sku"
  }
}

Schema Inference

The CSV connector automatically infers column types by sampling the first 100 rows:

Inferred TypeDetectionExample
stringDefault fallback"John Doe"
integerAll numeric, no decimal point42, 1000
floatNumeric with decimal point19.99, 3.14
booleantrue/false, yes/no, 1/0true
datetimeISO 8601 or common date formats2025-01-15T10:30:00Z
emailContains @ with domainuser@example.com
urlStarts with http:// or https://https://example.com

CSV Configuration Reference

FieldTypeDefaultDescription
file_pathstring--Local file path (mutually exclusive with url)
urlstring--URL to fetch the CSV from
node_labelstringrequiredNeo4j node label for imported rows
delimiterstring,Column delimiter
has_headerbooltrueFirst row contains column names
id_columnstring--Column to use as the unique node identifier
encodingstringutf-8File encoding
skip_rowsint0Number of rows to skip from the top
max_rowsint--Maximum rows to import
column_mappingobject--Rename columns: {"old_name": "new_name"}
relationship_columnsarray[]Columns that reference other nodes (see below)

JSON Connector

Configuration

File Upload

json
{
  "name": "API Export",
  "source_type": "json",
  "config": {
    "file_path": "/data/services.json",
    "node_label": "Service",
    "root_path": "$.services",
    "id_field": "id"
  }
}

URL-Based

json
{
  "name": "Remote Config",
  "source_type": "json",
  "config": {
    "url": "https://api.example.com/config.json",
    "node_label": "ConfigEntry",
    "root_path": "$",
    "id_field": "key",
    "headers": {
      "Authorization": "Bearer token"
    }
  }
}

JSON Path Support

Use JSONPath expressions to target specific parts of the JSON document:

PathDescriptionExample InputMatches
$Root (whole document)[{...}, {...}]All items
$.dataNested key{"data": [{...}]}Items in data
$.results[*]Array items{"results": [{...}]}Each result
$.teams[*].membersNested arrays{"teams": [{"members": [...]}]}All members

Schema Inference

For JSON objects, schema inference maps JSON types to Neo4j property types:

JSON TypeNeo4j TypeNotes
stringstringDirect mapping
number (integer)integerNo decimal point
number (float)floatHas decimal point
booleanbooleanDirect mapping
arraystring[]Stored as string array property
objectFlattenedNested objects are flattened with dot notation
null--Null values are omitted

JSON Configuration Reference

FieldTypeDefaultDescription
file_pathstring--Local file path (mutually exclusive with url)
urlstring--URL to fetch the JSON from
node_labelstringrequiredNeo4j node label for imported objects
root_pathstring$JSONPath to the array of objects to import
id_fieldstring--Field to use as the unique node identifier
headersobject{}HTTP headers for URL-based fetching
flatten_nestedbooltrueFlatten nested objects with dot notation
max_depthint3Maximum nesting depth to flatten
max_itemsint--Maximum items to import
relationship_fieldsarray[]Fields that reference other nodes

Graph Node Generation

Both connectors create typed nodes in Neo4j with all columns/fields as properties.

Basic Import

Given this CSV:

csv
customer_id,name,email,plan,signup_date
C001,Alice Smith,alice@example.com,pro,2025-01-15
C002,Bob Jones,bob@example.com,free,2025-02-01

With node_label: "Customer" and id_column: "customer_id", this creates:

cypher
(:Customer {customer_id: "C001", name: "Alice Smith", email: "alice@example.com",
            plan: "pro", signup_date: datetime("2025-01-15")})
(:Customer {customer_id: "C002", name: "Bob Jones", email: "bob@example.com",
            plan: "free", signup_date: datetime("2025-02-01")})

Relationship Columns

Define columns/fields that reference other nodes to automatically create relationships:

json
{
  "config": {
    "node_label": "Order",
    "id_column": "order_id",
    "relationship_columns": [
      {
        "column": "customer_id",
        "target_label": "Customer",
        "target_id_property": "customer_id",
        "relationship_type": "PLACED_BY"
      },
      {
        "column": "product_sku",
        "target_label": "Product",
        "target_id_property": "sku",
        "relationship_type": "CONTAINS"
      }
    ]
  }
}

This creates relationships between imported nodes and existing nodes in the graph:

cypher
(:Order {order_id: "O100"})-[:PLACED_BY]->(:Customer {customer_id: "C001"})
(:Order {order_id: "O100"})-[:CONTAINS]->(:Product {sku: "PROD-42"})

TIP

Relationship columns work across connector boundaries. You can import a CSV of deployment metadata and link it to Kubernetes pods or GitHub repositories already in the graph.

Use Cases

  • Import team rosters — CSV of team members linked to GitHub users
  • Load infrastructure inventories — JSON exports from CMDB systems
  • Enrich the graph — add business context (cost centers, SLAs, ownership) to technical resources
  • Bulk data migration — import historical data from legacy systems
  • Configuration audits — import and query JSON config files for consistency checks

Troubleshooting

ErrorCauseFix
File not foundFile path is incorrect or file does not existVerify the file path is absolute and accessible
Failed to fetch URLURL is unreachable or returned an errorCheck the URL and any authentication headers
Column not foundid_column references a non-existent columnVerify column names match the CSV header
Invalid JSONJSON file is malformedValidate the JSON with a linter
JSONPath matched no itemsroot_path does not match any array in the documentTest the JSONPath expression against your data
Encoding errorFile uses non-UTF-8 encodingSet the encoding field (e.g., latin-1, utf-16)

Built by AgentcyLabs. For in-house deployment or Agentcy Cloud (PaaS) access, visit agentcylabs.com.