IBM BPM, V8.0.1, All platforms > Programming IBM BPM > Developing using the JavaScript API > External JavaScript libraries

Use JSON

JSON is a string representation of a JavaScript object that can be transmitted over the network. You can use it to pass parameters inside IBM BPM.

An Open Source JavaScript implementation is available to both parse and construct JSON strings. Part of this package is a JavaScript source file called json2.js.


Procedure

Add this file to your toolkit or process application as a server managed file to provide new global methods and objects.


Example

This example illustrates how to taking a List of Complex data structure and building a JSON representation:
var newArray = new Array();
{
  var newObj = new Object();
  for (var property in tw.local.myPurchase[j].propertyNames)
  {
    var name = tw.local.myPurchase[j].propertyNames[property];
    newObj[name] = tw.local.myPurchase[j][name];
  }   newArray.push(newObj);} log.error("jsonText = " + jsonText);

Within a browser or the coach, you can use the Dojo classes to work with JSON:

External JavaScript libraries


Related information:

JSON in JavaScript