json - System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0., Culture=nuetral failed CRM 2011 -


i trying deserialize json string in crm 2011. json string arbitrary , not same fields (keys) returned. trying use system.runtime.serialization.json datacontractjsonserialzer method. found following code in post have modified need:

namespace test { [serializable] public class stringobjectdictionary : isafeserializationdata { public static dictonary<string, object> dict;  public stringobjectdictionary() { dict = new dictionary<string, object>(); }  protected stringobjectdictionary(serializationinfo info, streamingcontext context) { dict = new dictionary<string, object>(); foreach (serialization entry in info) { dict.add(key, dict[key]); } }  void isafeserializationdata.completedeserialization(object obj) { dictionary<string, object> _dict = obj dictionary<string, object>; foreach (string key in dict.keys) { _dict.add(key, dict[key] } } 

i calling above here:

test.stringobjectdictionary[] dummyarray = { new test.stringobjectdictionary() }; datacontractjsonserializer js = new datacontractjsonserializer(dummyarray.gettype()); memorystream stream = new memorystream(encoding.utf8.getbytes(jsonstring)); test.stringobjectdictionary[] dictarray =       (test.stringobjectdictionary[]).js.readobject(stream); 

i using following test json:

 string testjson = @"[{""id"":34,""crmid"":""df4a2ab8-f1ad-e311-abb3-00155d02ea01""}, {""id"":35,""crmid"":""df4a2ab8-f1ad-e311-abb3-0015d042fg94""}]; 

when build , deploy , test workflow receive security error. deployed in sandbox environment , needs work in crm online. possible allow class stringobjectdictionary trusted code can access system.security namespace?


Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -