I’m using a custom converter to encode an object model. On the client, I need an empty array but I don’t want to include this array in the object model on the server because the array is only used client-side.
This is what I have:
public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
{
MyObjectModel TheObjectModel = obj as ObjectModel;
Dictionary<string, object> OutputJson = new Dictionary<string, object>();
OutputJson.Add("MyEmptyArray", new Array()); // not working here
What do I need to put instead of new Array()?
Thanks
Use
ArrayListinstead ofArray. (Also, I think you meant to write “OutputJson” instead of “Output”.)Note the error message:
Arrayis an abstract class.