|
Hi there;
I'm new to Jint and I'm stock with some code in here, hope somebody can help me with that.
Basically I need to grab an array from some Javascript code and parse it's content onto a c# object.
The scenario:
I have this javascript code that returns an array, the code is pretty much like this:
var itemCol = new Array();
itemCol[0] = {
pid: "01010101",
Desc: "Some desc",
avail: "Available",
price: "$10.00"
};
itemCol[1] = {
pid: "01010101",
Desc: "Some desc",
avail: "Available",
price: "$10.00"
};
return itemCol;
Here is the c# I'm using to grab the array:
private object SerializeArray(string script)
{
Jint.JintEngine engine = new Jint.JintEngine();
Jint.Native.JsArray result = engine.Run(script);
return result;
}
When I run the function it returns a Jint.Native.JsArray object and it's Length property is 27, which is the exactly number of items inside the array.

However, I have no idea how to access the items, when i try the m_data collection each item appears to be empty.

The reason why I need it is simple:
I'm parsing/extracting content from some html pages.
Some of the information I need is embedded on Javascript code so, I though I could run the code using Jint and get what i need.
Thanks in advance.
|