You obviously want to access the object properties. What you currently have 
is roughly equivalent to this in javascript:

for (var i = 0; i < json_objects.length; i++) {
  var obj = json_objects[i];
  console.log(obj.toString());
}

While what you actually want is

for (var i = 0; i < json_objects.length; i++) {
  var obj = json_objects[i];
  console.log(obj.myProperty.toString());
}

You can use obj->Get(String::New("myProperty")) to get the property.
Or maybe you actually want to print the object using its toString method, 
which you have not defined yet.

I hope this helps.

Yang


On Friday, July 13, 2012 6:42:14 AM UTC+2, Charles Han wrote:
>
> Hi,
>
> I have managed to get an array back from JavaScript within C++. However, 
> when I got to access the elements of the array, I got something like this:
>
> [object Object]
> [object Object]
> [object Object]
> ...
>
> Code:
>
>   Array* uncompressed_json_objects = Array::Cast(*uncompressed_result);
>   for(int i =0; i<uncompressed_json_objects->Length(); i++ )
>   {
>     Local<Object> obj = uncompressed_json_objects->Get(i);
>     String::AsciiValue ascii(obj->ToString());
>     printf("%s\n", *ascii);
>   }
>
> What's the method to get values from a V8 array objects? ()
>
> Thanks
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to