C# and JSON

JQuery Parse JSON 

 

    var obj = $.parseJSON(data);

 

C# creates JSON string: 

 

   public static class JSONHelper

    {

        public static string ToJSON(this object obj)

        {

            JavaScriptSerializer serializer = new JavaScriptSerializer();

            return serializer.Serialize(obj);

        }

 

        public static string ToJSON(this object obj, int recursionDepth)

        {

            JavaScriptSerializer serializer = new JavaScriptSerializer();

            serializer.RecursionLimit = recursionDepth;

            return serializer.Serialize(obj);

        }

    }

 

 

 

你可能感兴趣的:(json)