Nected Docs
Try Nected For Free
  • 5 min QuickStart Guide
  • Getting Started
    • Introduction
    • Core Concepts
    • Use Cases
    • Tech Architecture
    • FAQs
  • INTEGRATIONS
    • Overview
    • Integrations Libraries
      • PostGres
      • MySQL
      • Oracle
      • MS SQL Server
      • Snowflake
      • MongoDB
      • RedShift
      • REST API
      • Google Sheets
      • Slack
    • Managing Integrations
  • DATASETS
    • Overview
    • Managing Dataset
  • Rules
    • Overview
    • Rule Types
      • SimpleRule
      • DecisionTable
      • Ruleset
      • Rule Chain
    • Rule Conditions
    • Rule Actions
    • Concepts
      • Rule Result
      • Test & Publish Rules
    • Add Input Attributes
      • JSON Input Attributes
      • List Input Attributes
  • Triggers
    • Trigger Rule via API
    • Trigger Rule via WebHook
    • Trigger Workflow via API
    • Trigger Workflow via WebHook
    • Scheduler
    • Rule Response Format
  • Workflow
    • Overview
    • Managing Workflow
    • Add Node
      • Action Nodes
        • Rule Node
        • Workflow Node
        • Custom Code Node
        • Database Node
        • REST API Node
      • Control Nodes
        • Loop Node
        • Delay Node
        • Response Node
        • Set Variables Node
        • Switch Block
    • Test & Publish Workflows
  • CODE AND DATABASE QUERIES
    • JavaScript Editor
    • Formula Editor
    • JSON Editor
    • List Editor
    • Excel-like Function
  • Embedded System
    • White-Labelling
    • Embeddable View
  • Self Hosting
    • Overview
    • Infrastructure Sizing
    • New Installation
      • Docker
      • Kubernetes
        • Set Up Kubernetes Cluster on AWS EKS
    • Additional Configuration
      • High Availability
      • Email Setup Guide
    • Upgrade Nected Version
  • Security
    • API Authentication
      • OAuth as part of Authentication under REST API
    • Role Based Access Control (RBAC)
    • SOC 2 Type 2, GDPR, ISO Compliance
  • Audit
    • Audit Trail
    • Approval Flow
    • Version Control & Rollback
    • Import/Export
  • Management API
    • Audit Log API
    • Global Variable API
  • References
    • Attribute Library
    • Global Variables
    • Pre-Configured Tokens
    • Pre-Configured Operators
    • NULL Value Handling/Behavior
    • Troubleshooting Errors
      • Multiple Tabs/Users Edits
      • Limits in Nected
    • Allowed Status Combinations
    • Environments
    • Usage Widget
    • Gen AI
  • ACCOUNT SETTINGS
    • Workspace Setting
      • Date Format and Timezone Settings
Powered by GitBook
On this page
  • Access JSON editor:
  • 1. Rule Input Attributes
  • 2. Rule Result
  • 3. Workflow Trigger Node
  • 4. Workflow SetVariable Node
  • 5. Workflow Response Node
  • Use JSON editor:
  • Raw Format
  • Pretty Format
  • Test & Save
  • Troubleshooting Guide
  • Conclusion
  1. CODE AND DATABASE QUERIES

JSON Editor

The JSON editor in Nected is a versatile tool designed to manage JSON data effectively within various contexts. It provides a dual interface: a raw code editor for direct JSON input and a no-code interface with added key buttons for easier manipulation. This editor is integrated into several parts of Nected, allowing for consistent and dynamic JSON data handling across rule inputs, rule results, and workflow nodes.

Access JSON editor:

The JSON editor is available inside:

  1. Rule

    1. As Input attributes

      1. Custom Input Param

      2. Fetch From API

    2. Rule Result

  2. Workflow:

    1. In trigger node

    2. In SetVariable node

    3. Response node

    4. Rest API Node

Let’s see how you can access the JSON Editor and write your custom code there:

1. Rule Input Attributes

You can easily use JSON editor inside the input attributes as an input param in the rule editor. If you want to set exhaustive data inside a single parameter, then you can use JSON as input. Inside the Input Attributes, you can access the JSON editor in the first tab i.e. as a direct input attribute as well as in the 3rd tab i.e. the inside the Rest API payload(if you’re using Post method).

1.1 Direct Input Attributes:

In the Input Attributes tab, you can directly use the JSON editorTo do this you need to follow these steps:

  1. Open the rule editor.

  2. Click on “+Add Input Attribute” to open the “Input Attribute” modal.

  3. In the “Input Attributes” tab, click on “Add field” and provide a property name.

  4. Select JSON from the datatype dropdown to open the JSON Editor. Here, you can add keys for later use.

Example Code:

{
  "key_name_1": "Nected",
  "key_name_2": 200,
  "key_name_3": {
    "key_name_1": "Value",
    "key_name_2": true,
    "key_name_3": "2024-07-01",
    "key_name_4": "2024-07-01T08:57:11Z"
  }
}

1.2 Fetch from API:

Inside the 3rd tab i.e. “Fetch from API” if you want to use a payload in your API then you can use the JSON editor for that. To add the payload you can select the JSON editor from the given dropdown list and add JSON as your payload like this:

You can not use tokens for this scenario, as here you’re configuring the input attributes for the rule, so no tokens are available at this point.

2. Rule Result

The JSON editor can also be used to manage the output results of rules. This is particularly useful when dealing with complex data structures. To configure the rule result using the JSON editor, follow these steps:

  1. Open the rule editor.

  2. Go to the Result section.

  3. Click on “Add Result” and select JSON from the dropdown list.

Example Code:

{
  "key_name_1": "Nected",
  "key_name_2": {{.globalVar.base_price}},
  "key_name_3": {
    "key_name_1": "{{.dataSet.customer_name}}",
    "key_name_2": true,
    "key_name_3": "2024-07-01",
    "key_name_4": "2024-07-01T08:57:11Z",
    "key_name_5": {{.customInput.Loan_amount[0]}},
    "key_name_6": {
      "key_name_1": {{.dataSet.inventory_booked_perc}},
      "key_name_2": "{{.globalVar.edtechLeadsBucketA}}",
      "key_name_3": "{{.dataSet.resultData[0].customer_name}}"
    }
  }
}

3. Workflow Trigger Node

Same as a rule, the JSON editor is also available for configuring input parameters for workflow trigger nodes. To use the JSON editor in this context, follow these steps:

  1. Open the workflow editor.

  2. Click on the trigger node to open a side modal with three tabs.

  3. In the “Input Params” tab, select JSON from the dropdown and add keys and their values.

Example Code:

{
  "key1": "Nected",
  "key_name_2": {
    "key_name_1": "Sample",
    "key_name_2": 2000,
    "key_name_3": true,
    "key_name_4": "2024-07-01",
    "key_name_5": "2024-07-01T08:50:34Z",
    "key_name_6": [
      "value1",
      200
    ]
  }
}

Same as in the rule, tokens cannot be used in this section as it functions as input attributes for the workflow editor.

4. Workflow SetVariable Node

You can also use JSON editor to set custom variables within workflow set variable node. Follow these steps to configure the set variable node:

  1. Open the workflow editor.

  2. Click on the “+” icon and select the SetVariable node from the list.

  3. In the side modal, click on "+ Add Field” and select JSON from the dropdown list.

  4. The JSON editor will open, allowing you to add keys and values. Any available tokens can be used.

Example Code:

{
  "key_name_1": "Nected",
  "key_name_2": {{.globalVar.base_price}},
  "key_name_3": {
    "key_name_1": "{{.dataSet.customer_name}}",
    "key_name_2": true,
    "key_name_3": "2024-07-01",
    "key_name_4": "2024-07-01T08:57:11Z",
    "key_name_5": {{.customInput.Loan_amount[0]}},
    "key_name_6": {{.Trigger.Transaction_amt}}
  }
}

5. Workflow Response Node

The JSON editor facilitates defining the response data for workflow response nodes. Similar to the SetVariable node, open the side modal and select JSON from the dropdown list to add keys and values. Here’s how to access and use it:

  1. Open the workflow editor and select the relevant workflow.

  2. Click on the “+” icon and select the Response node from the list.

  3. In the side modal that appears, choose JSON from the dropdown list to add keys and values. You can use any available tokens in this section.

Example Code:

{
  "key_name_1": "Nected", 
  "key_name_2": {{.globalVar.base_price}}, //numeric
  "key_name_3": {
    "key_name_1": "{{.dataSet.customer_name}}", //
    "key_name_2": true,
    "key_name_3": "2024-07-01",
    "key_name_4": "2024-07-01T08:57:11Z",
    "key_name_5": {{.customInput.Loan_amount[0]}},
    "key_name_6": {{.Trigger.Transaction_amt}}
  }
}

Use JSON editor:

The JSON editor in Nected provides a flexible interface for managing JSON data, allowing you to switch between raw code input and a no-code, pretty format interface. This section will guide you through using both formats effectively.

Raw Format

The raw format is ideal for users who are comfortable writing JSON code directly. This mode allows you to input JSON data with full control over the syntax and structure.

  1. Access the JSON Editor: Navigate to the relevant context (e.g., rule input parameters, rule results, workflow nodes) and open the JSON editor as described in the respective sections.

  2. Select Raw Code Mode:

    • In the JSON editor, choose the option to write raw code.

    • This will present a text area where you can manually enter your JSON data.

  3. Enter JSON Data:

    • Write your JSON data directly into the text area. Ensure that the data adheres to standard JSON syntax, including proper use of curly braces {}, square brackets [], colons :, and commas ,.

Example of Raw JSON Input:

{
  "key1": "value1",
  "key2": 123,
  "key3": true,
  "nestedObject": {
    "nestedKey1": "nestedValue1"
  },
  "listKey": [
    "item1",
    "item2",
    3,
    {
      "innerKey": "innerValue"
    }
  ]
}

Pretty Format

The pretty format, also known as the no-code mode, provides an intuitive interface with add key buttons that simplify the process of structuring and editing JSON data. This mode is particularly useful for users who prefer a visual approach to JSON editing.

  1. Access the JSON Editor: Navigate to the relevant context (e.g., rule input parameters, rule results, workflow nodes) and open the JSON editor as described in the respective sections.

  2. Select Pretty Format Mode:

    • In the JSON editor, choose the option to write in the pretty format (no-code mode).

    • This will present a form-like interface where you can add keys and values without manually writing JSON syntax.

  3. Add Keys and Values:

    • Use the add key buttons to create new keys in your JSON structure.

    • Enter the corresponding values for each key. You can add nested objects and lists by selecting the appropriate options from the interface.

  4. Incorporate Tokens:

    • If tokens are available in the context you are working in, you can incorporate them into your JSON data by selecting from the available token options and assigning them to the appropriate keys.

This will automatically generate the JSON structure in a pretty format without needing to write the raw code manually.

Test & Save

After writing the JSON data you can test it using the test button and check if everything is working fine or not.

Troubleshooting Guide

  • Syntax Errors: If your JSON data contains syntax errors, the editor will highlight the issues. Correct the highlighted areas and revalidate.

  • Token Issues: Ensure that tokens are correctly referenced and available in the context you are using them.

Conclusion

The JSON editor in Nected is a powerful tool that enhances your ability to manage JSON data seamlessly across different parts of the application. By understanding how to access and utilize the JSON editor in various contexts, you can streamline your workflow and ensure dynamic, flexible data handling. For further assistance, refer to Nected's support resources or contact the support team.

PreviousFormula EditorNextList Editor

Last updated 11 months ago

The JSON editor will open, allowing you to add keys and their values. Tokens available for use include customInput, globalVar, outputData, additionalData, dataSet, NULL. You can read the docs to get a better idea about tokens.

Pre-Configured token
json_ruleinput.gif
Screen Recording July 3.gif
json_result.gif
json_trigger.gif
json_setvar.gif
Screen Recording July 3 (1).gif