views:

272

answers:

1

The Rhino release that is included in Java 6 ScriptEngine does not have a JSON parser. I've tried including crockfords JSON2.js in my script on the scriptengine.eval(). When I try to do the JSON.parse, it ends up giving me a script error that .replace is an unknown function. .replace is referenced several places in JSON2, and it works fine inside a browser (IE7, IE8, FF3). Anyone see this and have a suggestion?

A: 

Thanks for loooking at this. I solved it. Pilot Error. Simply put, the string I was passing to JSON.parse was not a correct JSON string. It was a java object toString(). So, the error message was unhelpful, but I was giving bad content.

Tim