Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: using JSON.parse in a script

0
0
Hi,
I am trying to parse a json string as below (please let me know what i am doing wrong here)
engine.ExecuteCommand("JSON.parse('{\"x\":1}');");
I get the following exception:
Microsoft.ClearScript.ScriptEngineException: 'JSON' is undefined
Result StackTrace:
at Microsoft.ClearScript.ScriptEngine.ThrowScriptError(IScriptEngineException scriptError)
at Microsoft.ClearScript.Windows.WindowsScriptEngine.<>c__DisplayClass14.<ScriptInvoke>b__13()
at Microsoft.ClearScript.ScriptEngine.ScriptInvoke(Action action)
at Microsoft.ClearScript.Windows.WindowsScriptEngine.Execute(String documentName, String code, Boolean evaluate, Boolean discard)
at Microsoft.ClearScript.ScriptEngine.ExecuteCommand(String command)

Viewing all articles
Browse latest Browse all 2297