System.Web.Script.Serialization namespace error

string json = Get<string>("ProcessSchemaParamRespJson");
 
var dict = new JavaScriptSerializer().Deserialize<Dictionary<string,object>>(json);
var postalCode = dict["name"];
 
//Array is also possible
string[] result = dict.Select(kv => kv.Value.ToString()).ToArray();
string processedOutput = "Response Elements :  " ;
 
foreach(string val in result){
	processedOutput += " " + val;
}
Set("ProcessSchemaProcessedResponse", processedOutput);
 
return true;

I am trying to use Script to process json response from a web service call.

The validation of script fails with following error,although I have declared the namespace   System.Web.Script.Serialization under Usings section of the process. Any help here is appreciated. Being new to the Product, I am also looking forward to some link to  guideline documents for scripts.

 

 

Like 0

Like

1 comments

It's a good practice to post your code when you ask about the code errors. In this case it's much easier to find what's wrong with it.

http://prntscr.com/jzz7tu

As more detailed issue description you give, as more detailed answer you get ;)

Regarding the request. Bpm'online - it's an asp.net application. When you write c# code it will appear in a class. You can check the source code of the class by clicking on the "Open source code" button.

http://prntscr.com/jzz9or

Please investigate the code and find what's wrong with it. 

Please note that it's not enough to add "using" in an asp.net application. "using" should always be connected to a "reference". You can add additional libraries as references in the "External assemblies" section.

https://academy.bpmonline.com/documents/technic-sdk/7-12/configuration-…

http://prntscr.com/jzze8p

Additionally, if you're not sure if your code doesn't conflict in namespaces, then you can use full name of classes. For example

Using System.Text;

StringBuilder MyStringBuilder = new StringBuilder("Hello World!");

Is equal to

System.Text.StringBuilder MyStringBuilder = new System.Text.StringBuilder("Hello World!");

 

 

 

Show all comments