### Question:
RuleEngine { public ItemCollection evaluateJsonByScript(String json, String script) throws ScriptException { scriptEngine.put("data", json); Object jsonDataObject = scriptEngine.eval("JSON.parse(data);"); scriptEngine.put("data", jsonDataObject); scriptEngine.eval(script); ItemCollection result = convertScriptVariableToItemCollection("result"); return result; } RuleEngine();  RuleEngine(final String scriptLanguage); ScriptEngineManager getScriptEngineManager(); ScriptEngine getScriptEngine(); ItemCollection evaluateBusinessRule(String script, ItemCollection documentContext, ItemCollection event); ItemCollection evaluateJsonByScript(String json, String script); boolean evaluateBooleanExpression(String script, ItemCollection documentContext); Object[] evaluateNativeScriptArray(String expression); @SuppressWarnings({ "unchecked", "rawtypes" }) ItemCollection convertScriptVariableToItemCollection(String variable); static final String DEFAULT_SCRIPT_LANGUAGE; static final String INVALID_SCRIPT; }### Answer:
@Test public void testSimpleJsonParseByScript() throws IOException { String json = readFromFile("/json/simple_content.json"); String script = "var result={}; result.name=data.name;result.id=data.id;"; RuleEngine ruleEngine = new RuleEngine(); ItemCollection result = null; try { result = ruleEngine.evaluateJsonByScript(json, script); } catch (ScriptException e) { e.printStackTrace(); Assert.fail(); } Assert.assertNotNull(result); Assert.assertEquals("simple data", result.getItemValueString("name")); Assert.assertEquals(70805774, result.getItemValueInteger("id")); }