Using:JavascriptConverter in ASP.NET
I'm currently serializing objects like this:
public static string ObjToJson(List<MyObject> TheObjects){
JavascriptSerializer TheSerializer = new JavascriptSerializer();
TheSerializer.RegisterConverters( new JavascriptConverter [] { new ObjectToJson() });
string JsonObj = TheSerializer.Serialize(TheObjects);
return JsonObj; }
开发者_Python百科And then I have this:
public class TheObjToJson : JavascriptConverter{
public override IDictionary<string,object> Serialize (object obj, JavascriptSerializer serializer)
{
...
return jsonstring;
}
}
Is this the fastest/best way to do JSON in ASP.NET?
I think the most popular JSON library is json.net. It's fast and easy to use.
精彩评论