Skip to content

Instantly share code, notes, and snippets.

@sridatta
Created April 26, 2011 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sridatta/941668 to your computer and use it in GitHub Desktop.
Save sridatta/941668 to your computer and use it in GitHub Desktop.
Persistent<Context> parser_context = Context::New();
parser_context->Enter();
// json_symbol is just "JSON". parse_symbol is just "parse"
Local<Object> JSON = Local<Object>::Cast(parser_context->Global()->Get(json_symbol));
Local<Function> parser = Local<Function>::Cast(JSON->Get(parse_symbol));
//Do parsing here
Handle<Value> argv[1];
argv[0] = to_parse;
Persistent<Value> result = Persistent<Value>::New(parser->Call(module_handle, 1, argv));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment