I have a json string which I’m trying to pass into a silverlight command from my javascript. This is the line of code I’m trying to run:
silverlightPlugin.Content.essentialsViewer.RunCommand("findShapeInArea", "{'area':0,'shape':77}");
This works in Visual Studio 2010 but when I upload it to IIS7 and test I get this error when it runs:
“System.ArgumentException: Can not convert Integer to String. at System.Windows.Browser.ManagedObjectInfo.Invoke(ManagedObject obj, InvokeType invokeType, String memberName, ScriptParam[] args)
at System.Windows.Hosting.ManagedHost.InvokeScriptableMember(IntPtr pHandle, Int32 nMemberID, Int32 nInvokeType, Int32 nArgCount, ScriptParam[] pArgs, ScriptParam& pResult, ExceptionInfo& pExceptInfo)”
I’m not sure why it thinks that it’s trying to convert and Integer to a String. Does anyone know what’s going on here?
Ok I figured out the issue. When passing a json string like I’ve done above if the parameter is asking for a string then everything inside the json object must be of type string even though it’s already a string as a whole. So the code below worked: