Example #1
0
        void FunFromJson()
        {
            //1. class -> json string
            PackData _packData = new PackData()
            {
                code      = 1,
                error     = 2,
                callCount = 3
            };
            string _jsonStr = JsonConvert.SerializeObject(_packData);

            PackData _packData2 = new PackData();

            for (int i = 0; i < Constant.LOOP_MAX; i++)
            {
                _packData2 = JsonConvert.DeserializeObject <PackData>(_jsonStr);
            }
            Debug.Log("\t" + _packData2.ToString());
        }
Example #2
0
        void Fun_FromJson()
        {
            string _json = @"{
								'index': 0,
								'code': 1,
								'error': 2,
								'callCount': 3,
								'name': 'Apple',
								'expire': '2020-10-14T21:33:46.5538426+09:00',
								'items': [
											'One',
											'Two',
											'Three'
										]
								}"                                ;

            PackData _packData = null;

            for (int i = 0; i < Constant.LOOP_MAX; i++)
            {
                _packData = JsonConvert.DeserializeObject <PackData>(_json);
            }
            Debug.Log("\t" + _packData.ToString());
        }