title: v8 c++ - how to get object key values provided as arguments
body: <p>I'm passing a js object to my function like this</p>
  
  <pre><code>myFunc.do({'1':2});
  </code></pre>
  
  <p>I want to <code>std::cout</code> those key values pairs from my object in c++</p>
  
  <p>Here is what I have </p>
  
  <pre><code>Handle&lt;Object&gt; object = Handle&lt;Object&gt;::Cast(args[i]);
  Local&lt;Array&gt; objArray = object-&gt;GetPropertyNames();
  
   for(uint o=0; o &lt; objArray-&gt;Length(); o++) {
     Local&lt;Value&gt; val = objArray-&gt;Get(o);
     v8::String::Utf8Value str(val-&gt;ToString());
     std::string foo = std::string(*str);    
     std::cout &lt;&lt; "val is= " &lt;&lt; foo;
   }
  return;
  </code></pre>
  
  <p>I'm doing wrong with <code>object-&gt;GetPropertyNames();</code>, because it does not gets me the passed values</p>
  
  <p><strong><em>UPDATE</em></strong>
  Here is another useless try</p>
  
  <pre><code>Local&lt;Context&gt; context = isolate-&gt;GetCurrentContext();
  Local&lt;Object&gt; object = Local&lt;Object&gt;::Cast(args[i]);
  Local&lt;Array&gt; props;
  if (!object-&gt;GetOwnPropertyNames(context).ToLocal(&amp;props)) {
    std::cout &lt;&lt; "Error";
    return;
  }
  
  for (uint32_t p = 0; p &lt; props-&gt;Length(); ++p) {
    Local&lt;Value&gt; name;
    Local&lt;Value&gt; property_value;
    props-&gt;Get(context, p).ToLocal(&amp;name);
    v8::String::Utf8Value str(name-&gt;ToString());
    std::string foo = std::string(*str);    
    std::cout &lt;&lt; "val is= " &lt;&lt; foo; // outputs 0
  }
  </code></pre>
  
  <p>thanks for help</p>