I have this code:
ScriptEngine INTERPRETER = new ScriptEngineManager().getEngineByName("js");
obj = INTERPRETER.eval("var obj = {a:1, b:2};");
So, from the java object obj how can i extract the 2 value form the js object?
You can use something like this:
ScriptEngine INTERPRETER = new ScriptEngineManager().getEngineByName("js");
ScriptObjectMirror obj = (ScriptObjectMirror) INTERPRETER.eval("obj = {a:1, b:2};");
System.out.println(obj.get("b"));