是否有一个更清晰的方式来获取JavaScript对象的JSON表示比下面的kludge?访问犀牛的原生JSON.Stringify从Java
System.out.println(((ScriptableObject) scope).callMethod(
cx, (Scriptable) scope.get("JSON", scope),
"stringify", new Object[]{jsObject}));
其中jsObject是我想要的字符串化的ScriptableObject。
你好你能不能让我们对这个一看:http://stackoverflow.com/questions/17548552/scriptengine-how-to-pass-a-string-that-represent -json? – 2013-07-09 13:53:32
我想使用上述内容,但我无法弄清楚如何从Ant/Rhino/Script标签中获取范围。 Context似乎可以通过.getCurrentContext()访问,但不能确定范围。 – Joel 2013-08-30 16:12:13