File - JSON Parse
Type identifier:
file:json:parseCategory: File Operations
Description
The File - JSON Parse node reads a JSON file and parses its contents into a structured data object, validated against a configurable Schema. It supports standard JSON as well as JSONC (JSON with Comments) format and allows trailing commas for more lenient parsing.
Input Handles
Handle | Type | Description |
|---|---|---|
|
| The JSON file to parse. |
Output Handles
Handle | Type | Description |
|---|---|---|
| schema-defined | The parsed and validated JSON data matching the configured Schema. |
Configuration Options
Option | Type | Default | Description |
|---|---|---|---|
Allow Comments |
|
| Enable JSONC format to allow JavaScript-style comments ( |
Allow Trailing Commas |
|
| Allow trailing commas after the last item in arrays and objects. |
Schema | literal | reference | literal | Schema for validating and typing the parsed data. |
Schema Configuration
The Schema can be configured in two modes:
- Literal: Define an inline Schema using the Schema editor
- Reference: Reference an existing Schema by ID
Behaviour
- Receives a JSON file from the input handle
- Parses file content
- Validates parsed data against the configured Schema
- Outputs the validated, typed data
Error Path
- File Space mismatch: File belongs to a different Space
- File retrieval error: Failed to download the file
- Parse error: Invalid JSON syntax
- Validation error: Data doesn't match the Schema
Examples
Import Customer Data
Configuration:
- Allow Comments:
false - Allow Trailing Commas:
false Schema (literal):
{ type: "object", properties: { customerId: { type: "string" }, name: { type: "string" }, email: { type: "string" }, purchaseHistory: { type: "array", items: { type: "object", properties: { productId: { type: "string" }, quantity: { type: "number" }, date: { type: "string" } } } } } }
Input file (customer-data.json):
{
"customerId": "CUST-12345",
"name": "Jane Smith",
"email": "jane.smith@example.com",
"purchaseHistory": [
{
"productId": "PROD-001",
"quantity": 2,
"date": "2024-01-15"
},
{
"productId": "PROD-042",
"quantity": 1,
"date": "2024-02-03"
}
]
}Output (data):
{
"customerId": "CUST-12345",
"name": "Jane Smith",
"email": "jane.smith@example.com",
"purchaseHistory": [
{
"productId": "PROD-001",
"quantity": 2,
"date": "2024-01-15"
},
{
"productId": "PROD-042",
"quantity": 1,
"date": "2024-02-03"
}
]
}Parse API Response
Configuration:
- Schema (reference): Select the existing "User" Schema
Use case: Parse a cached JSON response and validate it against a known Schema.