liuying
2024-12-01 8bfe5dcf83cdcaa90c45ad86a8b464238748de7c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace iWareTestForm
{
    public class JsonFileHelper
    {
        /// <summary>
        /// 读取json内容
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string ReadJson(string path)
        {
            try
            {
                StreamReader sr = new StreamReader(path, Encoding.Default);
                String line;
                StringBuilder sb = new StringBuilder();
                while ((line = sr.ReadLine()) != null)
                {
                    sb.Append(line.ToString() + " \n");
                }
                return sb.ToString();
            }
            catch
            {
                throw;
            }
        }
    }
}