Hi again,
There are several issues with the above. The JSON sample isn't proper JSON, and the code sample (assuming it's JavaScript) seems to have at least one typo and is unlikely to work unless
Please refer to the working sample below, which uses the console for output (since we're not sure what
This sample writes "hello world" to the console. Note that if you're using JScript, you'll need
Good luck!
There are several issues with the above. The JSON sample isn't proper JSON, and the code sample (assuming it's JavaScript) seems to have at least one typo and is unlikely to work unless
Json is a reference to a custom object of some kind.Please refer to the working sample below, which uses the console for output (since we're not sure what
$alert is):engine.AddHostType(typeof(Console)); engine.Script.result = "[{\"content\": \"hello world\"}]"; engine.Execute(@" var j = JSON.parse(result); Console.WriteLine(j[0].content); ");
WindowsScriptEngineFlags.EnableStandardsMode to enable the standard JSON object.Good luck!