Package org.mozilla.javascript.json

Examples of org.mozilla.javascript.json.JsonParser.parseValue()


        }
        Scriptable scope = funObj.getParentScope();
        JsonParser parser = new JsonParser(cx, scope);
        Object parsed;
        try {
            parsed = parser.parseValue(json);
        } catch (ParseException e) {
            throw ScriptRuntime.constructError("Error", e.getMessage());
        }
        Object result;
        if (parsed instanceof NativeObject) {
View Full Code Here


    }

    private Scriptable parseJsonResource(Resource resource) throws IOException {
        JsonParser parser = new JsonParser(Context.getCurrentContext(), globalScope);
        try {
            Object result = parser.parseValue(resource.getContent());
            if (!(result instanceof Scriptable)) {
                throw new RuntimeException(
                        "Expected Object from package.json, got " + result);
            }
            return (Scriptable) result;
View Full Code Here

    @Override
    public Object load(Context cx, RhinoEngine engine, Object securityDomain,
                       String moduleName, String charset, Resource resource)
                       throws Exception {
        JsonParser json = new JsonParser(cx, engine.getScope());
        return json.parseValue(resource.getContent());
    }
}

class ClassModuleLoader extends ModuleLoader {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.