posted 14 years ago
Hi,
I am trying to convert a Java String into a JavaScript object and pass it to a JavaScript function in a .js file. Please note that the "fields" String in my code below is not of JSON format but is in the format of a JavaScript Object literal. That is the keys are not Strings, not enclosed in double quotes. So, I need to convert it into a JavaScript Object and not a JSON Object. Please see my simplified code below:
test.js
When I run the Java Code, the following error is thrown when the transform function is invoked:
sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot read property "length"
Thanks,
Sony