Oops, I realized the cast to Object was an assumption. I've updated it to
use Value instead.
using namespace v8; // but of course.
Handle<Value> parseJson(Handle<Value> jsonString) {
HandleScope scope;
Handle<Context> context = Context::GetCurrent();
Handle<Object> global = context->Global();
Handle<Object> JSON = global->Get(String::New("JSON"))->ToObject();
Handle<Function> JSON_parse =
Handle<Function>::Cast(JSON->Get(String::New("parse")));
// return JSON.parse.apply(JSON, jsonString);
return scope.Close(JSON_parse->Call(JSON, 1, &jsonString));
}
Thanks =)
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users