Java 6 ScriptEngine and JSON.parse problem
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 开发者_如何学Goa browser (IE7, IE8, FF3). Anyone see this and have a suggestion?
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.
精彩评论