Hello All,

A call to JSON::Stringify is returning empty handle. I ensured that the 
parameters are valid. What are the other possible reasons? I tried 
retrieving the "JSON" object from the context using context->Global(), that 
fails and returns empty handle.  

bool toJSON(v8::Isolate *isolate, const v8::Local<v8::Value> &object,
std::string &json) {

   json.clear();

    if (object.IsEmpty()) {    // Object is not empty
        return true;
    }

     v8::HandleScope handle_scope(isolate);
     auto context = isolate->GetCurrentContext();
      std::cout << "Context: " << context.IsEmpty() << "\n";
      std::cout << "converting to string \n";
      v8::Local<v8::Value> result;
      if (!v8::JSON::Stringify(context, object).ToLocal(&result))      // 
This call is failing
           return false;
       json = *v8::String::Utf8Value(isolate, result);
       std::cout << "done converting to string \n" << json;
       return true;
}

Any help would be very much appreciated, thanks!

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/709f6c10-0a23-4684-9637-568349a16706n%40googlegroups.com.

Reply via email to