Ejemplo n.º 1
0
        public static void FillObject()
        {
            NoExt ne = new NoExt();

            ne.Name    = "hello";
            ne.Address = "here";
            ne.Age     = 10;
            ne.dic     = new Dictionary <string, class1>();
            ne.dic.Add("hello", new class1("asda", "asdas", Guid.NewGuid()));
            ne.objs = new baseclass[] { new class1("a", "1", Guid.NewGuid()), new class2("b", "2", "desc") };

            string str = fastJSON.JSON.Instance.ToJSON(ne, new fastJSON.JSONParameters {
                UseExtensions = false, UsingGlobalTypes = false
            });
            string strr = fastJSON.JSON.Instance.Beautify(str);

            Console.WriteLine(strr);
            object dic = fastJSON.JSON.Instance.Parse(str);
            object oo  = fastJSON.JSON.Instance.ToObject <NoExt>(str);

            NoExt nee = new NoExt();

            nee.intern = new NoExt {
                Name = "aaa"
            };
            fastJSON.JSON.Instance.FillObject(nee, strr);
        }
Ejemplo n.º 2
0
    public static void FillObject()
    {
        NoExt ne = new NoExt();

        ne.Name    = "hello";
        ne.Address = "here";
        ne.Age     = 10;
        ne.dic     = new Dictionary <string, class1>();
        ne.dic.Add("hello", new class1("asda", "asdas", Guid.NewGuid()));
        ne.objs = new baseclass[] { new class1("a", "1", Guid.NewGuid()), new class2("b", "2", "desc") };

        byte[] str = BJSON.ToBJSON(ne, new BJSONParameters {
            UseExtensions = false, UsingGlobalTypes = false
        });
        object dic = BJSON.Parse(str);
        object oo  = BJSON.ToObject <NoExt>(str);

        NoExt nee = new NoExt();

        nee.intern = new NoExt {
            Name = "aaa"
        };
        BJSON.FillObject(nee, str);
    }
Ejemplo n.º 3
0
        public static void FillObject()
        {
            NoExt ne = new NoExt();
            ne.Name = "hello";
            ne.Address = "here";
            ne.Age = 10;
            ne.dic = new Dictionary<string, class1>();
            ne.dic.Add("hello", new class1("asda", "asdas", Guid.NewGuid()));
            ne.objs = new baseclass[] { new class1("a", "1", Guid.NewGuid()), new class2("b", "2", "desc") };

            byte[] str = fastBinaryJSON.BJSON.ToBJSON(ne, new fastBinaryJSON.BJSONParameters { UseExtensions = false, UsingGlobalTypes = false });
            object dic = fastBinaryJSON.BJSON.Parse(str);
            object oo = fastBinaryJSON.BJSON.ToObject<NoExt>(str);

            NoExt nee = new NoExt();
            nee.intern = new NoExt { Name = "aaa" };
            fastBinaryJSON.BJSON.FillObject(nee, str);
        }