Login
Free Sign Up
Docs
/

File - JSON Parse

Type identifier: file:json:parse Category: 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

file

file (json)

The JSON file to parse.

Output Handles

Handle

Type

Description

data

schema-defined

The parsed and validated JSON data matching the configured Schema.

Configuration Options

Option

Type

Default

Description

Allow Comments

boolean

false

Enable JSONC format to allow JavaScript-style comments (// and /* */).

Allow Trailing Commas

boolean

false

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:

  1. Literal: Define an inline Schema using the Schema editor
  2. Reference: Reference an existing Schema by ID

Behaviour

  1. Receives a JSON file from the input handle
  2. Parses file content
  3. Validates parsed data against the configured Schema
  4. 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.

Related pages