public DataObject VisitObj(JSONParser.ObjContext context) { if (context.pair() != null && context.pair().Length > 0) { DataObject obj = new DataObject(); foreach (var p in context.pair()) { if (p.value() != null) { obj.AddField(VisitPair(p)); } else { obj.AddField(p.STRING().GetText().Trim('"'), VisitComplex_value(p.complex_value())); } } return(obj); } else { return(new DataObject()); } }
public DataItem VisitRow(List <string> names, CSVParser.RowContext context) { DataObject item = new DataObject(); if (names.Count != context.field().Length) { throw new Exception("Wrong number of elements"); } for (int a = 0; a < names.Count; a++) { item.AddField(names[a], new DataValue() { Text = CleanField(context.field()[a].GetText()) }); } return(item); }