4 min readUpdated Mar 2, 2026

writeJson

Overview

The writeJson logic is a powerful utility designed to serialize input data into JSON format and save it to a specified location in Google Drive, particularly to the "Intuidy" folder. This functionality is crucial for applications that need to export or share structured data in a widely accepted format such as JSON.

Settings

The writeJson logic includes several configurable settings that affect its behavior and output. Below is a comprehensive description of each setting:

1. fileName

2. subfolder

Inputs

How It Works

When the writeJson function is called, it performs the following steps:

  1. It receives the input data, configuration, and context parameters.
  2. It sets up the configuration for the writeFileNode, including serializing the input data into JSON format.
  3. It defines the MIME type as application/json, ensuring compatibility with the JSON format, and specifies that the format is 'json' without converting it to a spreadsheet format.
  4. The function then calls the writeFileNode, which is responsible for actually writing the serialized JSON data into the specified file within Google Drive.

The logic is asynchronous, implying that it can handle other tasks while waiting for Google Drive operations to complete, thereby improving efficiency.

Use Cases & Examples

Use Case 1: Data Export for Reporting

A business analytics team may need to regularly export large datasets of customer interactions for reporting purposes. Using writeJson, they can automate this process, ensuring data is always up-to-date and structured correctly.

Use Case 2: Sharing Configuration Data

A software development team may want to share configuration settings or environment variables stored in JSON format with the wider team or stakeholders. This allows easier understanding and modification of settings.

Use Case 3: Data Archiving

Organizations often require archiving logs or transaction data for compliance. The writeJson logic can be utilized to serialize and save these data sets automatically to Google Drive on a scheduled basis.

Detailed Example

Scenario: Automating Customer Data Exports

The marketing department of a company needs to export customer engagement data collected from various campaigns for analysis. They can configure the writeJson logic as follows:

json
{
  "inputs": {
    "data": [
      {"customerID": 1, "engagementScore": 75, "lastEngaged": "2023-10-15"},
      {"customerID": 2, "engagementScore": 85, "lastEngaged": "2023-10-18"}
    ]
  },
  "config": {
    "fileName": "customer_engagement_data.json",
    "subfolder": "Marketing/Engagements"
  },
  "context": {}
}

Explanation of Configuration:

This configuration allows for automation and consistency in the data export, facilitating efficient data analysis by the marketing team.