现在只研究了2种方法解析Json;
第一种比较僵硬,当Json结构发生变化的需要修改代码,虽然改的也不多;
第二种是**重写JsonConverter **这个有点头大,还在研究[https://docs.microsoft.com/zh-cn/dotnet/standard/serialization/system-text-json-converters-how-to?pivots=dotnet-5-0]
下面是第一种:
Json数组转化为字典
然后字典使用Linq随意加工了

#region 转换jsonStr为字典
        /// <summary>
        /// 转换jsonStr为字典
        /// </summary>
        /// <param name="jsonStr">Json字符串
        /// <returns></returns>
        public static Dictionary<string, int> ConvertToDic(string jsonStr)
        {
            Dictionary<string, int> dic = new Dictionary<string, int>();
            if (jsonStr.Trim() == null) return dic;
            JArray jObj = JArray.Parse(jsonStr);
            IJEnumerable<JToken> jsonObjEnumerable = jObj.AsJEnumerable();
            foreach (JToken item in jsonObjEnumerable)
            {
                string key = (string)item["item"];
                int value = (int)item["value"];
                dic.Add(key, value);
            }
            return dic;
        }
        #endregion

再将字典序列化

//The parameter Formatting.Indented tells Json.Net to serialize the data with indentation and new lines.
//If you don't do that, the serialized string will be one long string with no indentation or line breaks.
 string str = JsonConvert.SerializeObject(dic, Formatting.Indented);

测试:输入的数据为:[{"item":"1316","value":1194},{"item":"1720","value":1359},{"item":"20+","value":15238},{"item":"04","value":24666},{"item":"58","value":1550},{"item":"9~12","value":1212}]
输出结果:JsonToLinq_jar