public static void Main()
dynamic steps_keys = null;
using (var r = ChoJSONReader.LoadText(json).WithJSONPath("$..Job.Keys"))
keys = r.FirstOrDefault();
using (var r = ChoJSONReader.LoadText(json).WithJSONPath("$..Job.Props"))
props = r.FirstOrDefault();
using (var r = ChoJSONReader.LoadText(json).WithJSONPath("$..Job.Steps.Keys"))
steps_keys = r.FirstOrDefault();
using (var r = ChoJSONReader.LoadText(json).WithJSONPath("$..Job.Steps.InstrumentData")
.Setup(s => s.RowsLoaded += (o, e) => $"Rows loaded: {e.RowsLoaded} <- {DateTime.Now}".Print())
.Configure(c => c.CustomJObjectLoader = (sr, s) =>
string outFilePath = $"C:\\Projects\\GitHub\\ChoETL\\data\\InstrumentData_{fileCount++}.json";
$"Writing to `{outFilePath}` file...".Print();
using (var topJo = new ChoJObjectWriter(Console.Out))
topJo.Formatting = Newtonsoft.Json.Formatting.Indented;
using (var job_jo = new ChoJObjectWriter("Job", topJo))
job_jo.WriteProperty("Keys", keys);
job_jo.WriteProperty("Props", props);
using (var steps_jo = new ChoJObjectWriter("Steps", job_jo))
steps_jo.WriteProperty("Keys", steps_keys);
steps_jo.WriteProperty("InstrumentData", sr);
return ChoJSONObjects.EmptyJObject;
static void PrintLibVersion()
$"{typeof(ChoJSONReader).Assembly.GetName().Name} v{typeof(ChoJSONReader).Assembly.GetName().Version.ToString()}".Print();
""FileType"": ""Measurements"",
""InstrumentDescriptions"": [
""InstrumentID"": ""1723007"",
""InstrumentType"": ""Actual1"",
""DataType"": ""Double"",
""InstrumentID"": ""2424009"",
""InstrumentType"": ""Actual2"",
""DataType"": ""Double"",
""StepResult"": ""NormalEnd""
""InstrumentID"": ""1723007""
""DateTime"": ""2021-11-16 21:18:37.000"",
""DateTime"": ""2021-11-16 21:18:37.100"",
""DateTime"": ""2021-11-16 21:18:37.200"",
""DateTime"": ""2021-11-16 21:18:37.300"",
""DateTime"": ""2021-11-16 21:18:37.400"",
""DateTime"": ""2021-11-16 21:18:37.500"",
""DateTime"": ""2021-11-16 21:18:37.600"",
""DateTime"": ""2021-11-16 21:18:37.700"",
""DateTime"": ""2021-11-16 21:18:37.800"",
""InstrumentID"": ""2424009""
""DateTime"": ""2021-11-16 21:18:37.000"",
""DateTime"": ""2021-11-16 21:18:37.100"",
""DateTime"": ""2021-11-16 21:18:37.200"",
""DateTime"": ""2021-11-16 21:18:37.300"",
""DateTime"": ""2021-11-16 21:18:37.400"",
""DateTime"": ""2021-11-16 21:18:37.500"",
""DateTime"": ""2021-11-16 21:18:37.600"",
""DateTime"": ""2021-11-16 21:18:37.700"",
""DateTime"": ""2021-11-16 21:18:37.800"",