AnalyzeJSON.cs 538 B

12345678910111213141516171819202122
  1. using System;
  2. using System.IO;
  3. using Newtonsoft.Json;
  4. using Newtonsoft.Json.Linq;
  5. namespace analyzeJSON
  6. {
  7. public class AnalyzeJSON
  8. {
  9. private readonly JObject json;
  10. public AnalyzeJSON(string path)
  11. {
  12. if (!File.Exists(path))
  13. throw new ArgumentNullException("File doesn't exist!");
  14. using StreamReader sr = new StreamReader(path);
  15. var jsonString = sr.ReadToEnd();
  16. json = JsonConvert.DeserializeObject<JObject>(jsonString);
  17. }
  18. }
  19. }