Enhanced JSON Tool Plugin

Introduction

The Enhanced JSON Tool plugin builds upon the default bundled JSON Tool in Joget. It addresses scenarios where post-processing of the JSON response from a JSON API call is needed before storing data into a form or workflow variable. This plugin retains all the configurations of the default JSON Tool, with the added ability to format or modify the JSON response using a BeanShell script. The post-processed response is also returned at the end of the execute() method for further integration.

This plugin works just like the default bundled JSON Tool in Joget but with the following added abilities:

  • Supports GET, PATCH, PUT, and POST methods.
  • Allows sending files in the POST method.
  • Can receive files and store them into a Joget form file upload.

The plugin's source code is available in the JogetOSS GitHub repository. You can clone and customize it to meet your specific requirements.

Get started

Where to get the plugin

You can download the plugin from the Enhanced JSON Tool GitHub releases page.

How to install

  1. Download the plugin JAR file from the releases page.
  2. Go to Settings > Manage Plugins > Upload Plugin.
  3. Once uploaded, the plugin will be available in your Joget environment.

Configure enhanced JSON tool properties

To learn how to configure the JSON Tool plugin, see the KB page for JSON API Tool. This plugin's configuration is identical, only with the additional configurable properties below.

Fields to configure:

  • Connection Timeout: Specifies the maximum time (in seconds) that the client will wait to establish a connection with the server. If the connection cannot be established within this time, an error will be thrown and logged.
  • Socket Timeout: Specifies the maximum time (in seconds) that the client will wait for a server response after the connection is established. If no response is received within this time, an error will be thrown and logged.

Format Response

Important
You can only see this property if you select JSON for your Response Type.

Fields to configure:

  • Enable Response Formatting: When checked, this option allows you to write a BeanShell script to format or post-process the JSON response.
  • Script: The Enable Response Formatting property must be enabled in order to write the BeanShell script here.
    The field where you input your BeanShell script.
    • Injected Variables:
      • data: This is a Map object of the JSON response from the JSON API call.
    • Expected Return Object: It is expected to return a Map object that will later be processed and configured to store form and workflow variables.

      Example:

      Return the response only for the first item in a JSON array with the object name "apps".

      return data.get("apps")[0];

Download plugin

Download sample app

Download the demo app for Enhanced JSON Tool Plugin:
This sample app does not include the Enhanced JSON Tool plugin. Ensure you install the plugin separately from the GitHub releases page and configure the API Domain Whitelist or API IP Whitelist in the General Settings to allow JSON API requests.
Created by Julieth Last modified by Julieth on Nov 27, 2024