I have a text file which contains nearly million records in json format. Like
[{"ev":"AM","sym":"TMHC","v":1000,"av":74917,"op":18.92,"vw":19.1305,"o":19.13,"c":19.15,"h":19.15,"l":19.13,"a":19.143,"z":90,"n":1,"s":1549380300000,"e":1549380360000},{"ev":"AM","sym":"AAPL","v":7103,"av":184266,"op":35.27,"vw":35.3148,"o":35.3264,"c":35.34,"h":35.34,"l":35.3258,"a":35.3345,"z":710,"n":1,"s":1549380300000,"e":1549380360000}]
[{"ev":"AM","sym":"VB","v":213,"av":98285,"op":149.75,"vw":150.0575,"o":150.2104,"c":150.2104,"h":150.2104,"l":150.2104,"a":150.1944,"z":35,"n":1,"s":1549380300000,"e":1549380360000}]
So I need to find json element list from file which contains AAPL. Like if I will pass AAPL then it must give json element list of AAPL from whole file.
{"ev":"AM","sym":"AAPL","v":7103,"av":184266,"op":35.27,"vw":35.3148,"o":35.3264,"c":35.34,"h":35.34,"l":35.3258,"a":35.3345,"z":710,"n":1,"s":1549380300000,"e":1549380360000}
So how can I find it? I am trying to use JSONPATH for this but at a JObject convert time it's giving error like
Error reading JObject from JsonReader
I have apply below code for it :
const string filePath = @"D:\Aggregate_Minute_AAPL.json";
string text = System.IO.File.ReadAllText(filePath);
Newtonsoft.Json.Linq.JArray jsonArray = Newtonsoft.Json.Linq.JArray.Parse(text);
var json = Newtonsoft.Json.Linq.JObject.Parse(jsonArray.ToString());
var title = json.SelectToken("$.ev.sym[*]");
Console.WriteLine(title.First());
{ ... }[{...}]. And in searching for this error it's showing me that to remove square brackets from records. But there are very large record in file so for make loop for remove it will also take time.