是否有一個更清晰的方式來獲取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