I found a solution. The V8ScriptItem is a DynamicObject - so this works:
public class Konsoll
{
private void logg(int indent, dynamic o)
{
foreach (string egenskap in o.GetDynamicMemberNames())
{
Console.Write(new String(' ', indent));
Console.Write(egenskap);
Console.Write(':');
if (o[egenskap] is System.Dynamic.DynamicObject)
{
Console.WriteLine();
logg(indent + 1, o[egenskap]);
}
else
{
Console.WriteLine(o[egenskap].ToString());
}
}
}
public void log(dynamic o)
{
logg(0, o);
}
}
soengine.Execute("console.log({v1:4,v2:['a','bc', 'de', {f:'g'}],h:1,i:2,j:3,k:4});");
will outputv1:4
v2:
0:a
1:bc
2:de
3:
f:g
h:1
i:2
j:3
k:4
Clearscript is really cool stuff.