How to render dynamic data in my custom JsonToText module

Hi all,

Building an extension to convert a DB Query output (JSON) into plain text for LLM analysis.

Looks like I have it nearly working - the issue being that the output for the new extension is just displaying the handlebars from the serverDataBindings.

Here is the HJSON:

[
  {
    type: 'jsonToText',
    module: 'JsonToText',
    action: 'jsonToText',
    groupTitle: 'JSON to Text',
    groupIcon: 'fal fa-lg fal fa-code comp-data',
    title: 'JSON to Text @@var(name)@@',
    icon: 'fal fa-lg fa-code comp-data',
    dataPickObject: true,
    serverDataBindings: true,
    outputType: "text",
    dataScheme: [
    {
      name: 'response',
      title: 'Data',
      type: 'text'
    }
  ],
    properties: [
      {
        group: 'JSON to Text options',
        variables: [
          { name: 'name', optionName: 'name', title: 'Name', type: 'text', required: true, defaultValue: '', help: 'This will be the name for the output key and the tag used in the expression builder', serverDataBindings: true},
          { name: 'data', optionName: 'data', title: 'JSON Data', type: 'text', required: true, defaultValue: '', help: 'Enter the JSON data that you want to convert to plain text.', serverDataBindings: true}
        ]
      }
    ]
  }
]

Here is the JS:
// JavaScript Document

exports.jsonToText = async function (options) {
    try {
        const module = await import('json-stringify-pretty-compact');
        const stringify = module.default;
        const data = options.data ? JSON.stringify(options.data) : '{}';
        const result = stringify(JSON.parse(data));
        return result;
    } catch (err) {
        console.error("Error:", err); // Log any errors
        throw new Error('Invalid JSON data');
    }
};

The response I get in the console is:

test: "\"{{job_data}}\""

Which indicates to me that it’s not recognizing the dynamic data handler (if that’s what you call it) and just outputting this as it’s written.

Any ideas where i’m going wrong.

Solved, with the help of some other extensions on here. I’ll upload the first version soon in case anyone finds something like this useful.