比如我反序列化JSON后是这样的
{"trade":{"a":"1","b":"2","c":"3","d":"4"}}
我怎么样循环为每个值+1输出啊JSONc#.net

解决方案 »

  1.   

    从json转为对象,然后为每个属性的值+1,得到最终结果。
      

  2.   

     Userinfo user = new Userinfo();
                user = JsonConvert.DeserializeObject<Userinfo>(responsetet);
      

  3.   

    先反序列化为一个Dictionary,遍历value给value各+1,然后序列化为json,最后反序列化为你的对象。要求达到了,给分。
      

  4.   

    定义一个这样的类,Set的时候会自动+1:
    public class AAA
    {
        public BBB trade{get;set;}
    }
    public class BBB
    {
        int _a;
        public int a
        {
            get{return _a;}
            set{_a = ++value;}
        }    int _b;
        public int b
        {
            get{return _b;}
            set{_b = ++value;}
        }    int _c;
        public int c
        {
            get{return _c;}
            set{_c = ++value;}
        }    int _d;
        public int d
        {
            get{return _d;}
            set{_d = ++value;}
        }
    }