This section describes how to use a JSON formatter for AJAX requests in a IBM® WebSphere® Multichannel Bank Transformation Toolkit application.
The response data for an AJAX request is retrieved from the context that contains the execution result of the request, and then the format of the data is converted for the response. Data for the response can be converted by using two different methods: the default data conversion method in WebSphere Multichannel Bank Transformation Toolkit HTML channel and by using the WebSphere Multichannel Bank Transformation Toolkit JSON formatter.
However, converting all the data elements in a context, including data elements that are not required for a response, might cause overhead on a network, and the conversion of the unnecessary data might have unwanted effects on the browser side. A JSON formatter converts only the data that is required for response to an AJAX request. The JSON formatter can retrieve data both from the operation context and the parent contexts of operation context.
To use the JSON formatter for AJAX requests, you must first define the JSON formatter and then reference the JSON formatter in the AJAX request operation. For information on how to define the JSON formatter, refer to the Defining the request data format topic.