您当前的位置: 首页 >  unity

染指流年灬

暂无认证

  • 3浏览

    0关注

    194博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

unity读取本地.json后缀的文件夹

染指流年灬 发布时间:2019-03-28 12:02:16 ,浏览量:3

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

        /// 
        /// 读取JSON文件
        /// 
        /// JSON文件中的key值
        /// JSON文件中的value值
        public static string Readjson(string key)
        {
            string jsonfile = "D://testJson.json";//JSON文件路径

            using (System.IO.StreamReader file = System.IO.File.OpenText(jsonfile))
            {
                using (JsonTextReader reader = new JsonTextReader(file))
                {
                    JObject o = (JObject)JToken.ReadFrom(reader);
                  
                    return o.tostring();
                }
            }
        }

这个方法有个弊端就是 这个json里面不能有//的注释 否则读取不出来

关注
打赏
1665909078
查看更多评论
立即登录/注册

微信扫码登录

0.3034s