• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Converting Java String to JavaScript object and passing it to a JavaScript procedure

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving for an appropriate forum
 
reply
    Bookmark Topic Watch Topic
  • New Topic