Skip to main content

Documentation Index

Fetch the complete documentation index at: https://hypha-docs.plinqx.app/llms.txt

Use this file to discover all available pages before exploring further.

The JSON Builder node constructs JSON objects with type coercion from expressions or default values, providing a structured way to build complex JSON.

Overview

JSON Builder nodes enable:
  • Structured JSON: Build complex JSON structures
  • Type Safety: Ensure correct data types
  • Expression Binding: Use expressions for field values
  • Default Values: Provide default values for fields

How It Works

1

Define Fields

Define JSON structure with field definitions.
2

Set Types

Specify type for each field (string, number, boolean, object, array).
3

Bind Expressions

Bind expressions or default values to fields.
4

Build JSON

Node builds JSON object with type coercion.

Configuration

Field Definitions

Define fields with:
  • Name: Field name in output JSON
  • Type: Data type (string, number, boolean, object, array, null)
  • Expression: Expression to evaluate (optional)
  • Default Value: Default value if expression is null/undefined (optional)

Field Types

Primitive Types

  • String: Text values
  • Number: Numeric values
  • Boolean: True/false values
  • Null: Null values

Complex Types

  • Object: Nested objects with properties
  • Array: Arrays with item schema

Example Configuration

{
  "fields": [
    {
      "name": "userId",
      "type": "string",
      "expression": "{{START.userId}}"
    },
    {
      "name": "count",
      "type": "number",
      "expression": "{{action.response.count}}",
      "defaultValue": 0
    },
    {
      "name": "active",
      "type": "boolean",
      "expression": "{{START.status}} === 'active'"
    },
    {
      "name": "metadata",
      "type": "object",
      "properties": [
        {
          "name": "source",
          "type": "string",
          "expression": "{{START.source}}"
        }
      ]
    }
  ]
}

Type Coercion

JSON Builder automatically coerces values to specified types:
  • String: Converts to string
  • Number: Converts to number (validates numeric)
  • Boolean: Converts to boolean
  • Array: Validates array structure
  • Object: Validates object structure

Nested Structures

Build nested objects and arrays:
  • Nested Objects: Define object fields with properties
  • Arrays: Define array fields with item schema
  • Deep Nesting: Support multiple levels of nesting

Use Cases

  • API Requests: Build structured request bodies
  • Data Transformation: Transform data into specific formats
  • Response Construction: Build consistent response structures
  • Schema Compliance: Ensure data matches schemas

Best Practices

Define Schema

Clearly define field types and structure

Use Defaults

Provide default values for optional fields

Validate Types

Ensure expressions return correct types

Document Structure

Document complex nested structures

Next Steps

VALIDATE Node

Validate built JSON against schema

Transform Node

Alternative for simple transformations