BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only

BAW: TWObject and JSON Conversion with BAWJSONUtils 

Sun November 17, 2024 05:09 AM

A unified JavaScript library for IBM BAW (Business Automation Workflow) that converts between TW Objects and JSON strings with configurable logging.

Installation

Simply include the toolkit to any Process App / import the JS file in any toolkit / Process App.

1. TWToJSON - Convert TW Object to JSON String

Converts any IBM BAW TW Object (including Lists, Maps, Dates, TWObjects) to a JSON string.

// Basic usage (no logging)
var jsonString = BAWJSONUtils.TWToJSON(tw.local.myObject);
 
// With logging enabled for debugging
var jsonString = BAWJSONUtils.TWToJSON(tw.local.myComplexObject, true);

2. JSONToTW - Convert JSON String to TW Object

Parses JSON string and optionally assigns it to a TW variable path. Handles Map XML strings automatically.

// Parse and assign 
BAWJSONUtils.JSONToTW(
    '{"name":"John","age":30}',
    'tw.local.employee',
    false  // logging disabled
);
 
// With logging enabled for debugging
BAWJSONUtils.JSONToTW(
    jsonString,
    'tw.local.result',
    true,  // logging enabled
    null   // optional reviver function
);

Statistics
0 Favorited
44 Views
3 Files
0 Shares
12 Downloads
Attachment(s)
zip file
BAW_JSON_Conversion_Toolkit - 1.0.0.zip   13.00 MB   1 version
Uploaded - Sun November 17, 2024
zip file
BAW_JSON_Conversion_Toolkit - 1.0.1.zip   13.36 MB   1 version
Uploaded - Sun January 19, 2025
zip file
BAW_JSON_Conversion_Toolkit - 1.0.2.zip   13.47 MB   1 version
Uploaded - Sun November 02, 2025

Comments

Fri July 04, 2025 07:13 AM

I am getting an error when trying to import into toolkits. Is there a way to troubleshoot this? Thank you.

Thu January 16, 2025 11:13 PM

@Jheyson Mogollón

Can you please share the details of implementation and the error you are getting via atanuroy@live.in

Thanks!

Thu January 16, 2025 10:31 PM

i get an error when i tried to use JSONToTW(jsonString, mappingVariableName) with an Twobject from an external service to an Twobject from ads with the same estructure.