Пример #1
0
    public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
    {
        // throw new NotImplementedException();


        if (obj == null)
        {
            throw new ArgumentNullException("dictionary");
        }
        //StringBuilder str = new StringBuilder();

        DynamicJsonConverter.DynamicJsonObject DynamicJsonObject = (DynamicJsonObject)obj;



        return(DynamicJsonObject._dictionary);
    }
Пример #2
0
    public string getJson()
    {
        string jsonData = string.Empty;

        try
        {
            var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            serializer.RegisterConverters(new[] { new DynamicJsonConverter() });
            DynamicJsonConverter.DynamicJsonObject DynamicJsonObject = JsonObject;
            if (DynamicJsonObject != null)
            {
                jsonData = DynamicJsonObject.ToString();
            }
        }
        catch (Exception e)
        {
            throw;
        }
        return(jsonData);
    }