November 01, 2013

JSON and Siebel

JSON(JavaScript Object Notation) is a new lightweight integration message format which is replacing XML in thin client integrations. There are no meta tags and data description in JSON as in XML, it is just a string representation of JavaScript Object, it is designed to help javascript code to convert data to string and string to data without considerable overhead.


Many companies have started replacing XML with JSON in APIs. All the APIs of Google (Maps,Mail,Calendar, plus etc are now serving JSON), Twitter API,  Facebook apps and interfaces are built using JSON.
Read more on JSON on :

Siebel lacks in support of JSON on server side. Oracle support recommends use of workarounds such as using custom scripting to parse JSON response received by Siebel.

So how to interpret json in Siebel? Answer lies in the escript engine of Siebel. Siebel eScript as we know is actually ECMA script which was basis of Javascript. That is why the syntax of Javascript and eScript closely matches each other.
ECMA adopted JSON before it became standard in javascript. Thus our well known Siebel eScript also have some support.

ECMA script provide eval method to convert string into an object. This method is also available in Siebel eScript.

From Siebel Tools help:
The Evaluate Expression method evaluates the value that the expression argument contains. It returns the value that it evaluates in the expression argument. If the expression argument is a string, then this method attempts to interpret the string as if it is JavaScript code.

On these lines I wrote small piece of code to test.

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
var bs = TheApplication().GetService("EAI HTTP Transport");
var inp = TheApplication().NewPropertySet();
var op = TheApplication().NewPropertySet();
var temp = op.GetValue();
eval("var json = " + temp);var temp2 = TheApplication().NewPropertySet();
return (CancelOperation);

function jsonParser(json,ps)
for (var prop in json) {if (typeof(json[prop]) == "object") {
var child = TheApplication().NewPropertySet();
child= null;

This code was able to convert the JSON in to an object and by using some loops it was able to return back the property set representing JSON. It is just a proof of concept code, I need to work on the memory allocation of the recursive function. Looking forward to hear some thoughts from experts.
output of business service

child property set

In case if you are facing difficulty in interpreting the JSON using notepad you can use online viewer :

Disclaimer: This code is just a proof of concept, do not use it in production environments without thorough testing.



  1. Can we use POST,PUT Methods also in a similar fashion?

    1. Sadhna, this code is only used for converting json to property set. To use post and put method you will need to use EAI JSON Converter described here