public static IEnumerable <DynamicData> ReadAsSeparatedObjects(this Json2SquidexConverter converter, Stream stream, string separator) { var sb = new StringBuilder(); using (var streamReader = new StreamReader(stream)) { string?line; while ((line = streamReader.ReadLine()) != null) { if (line.Equals(separator, StringComparison.OrdinalIgnoreCase)) { using (var stringReader = new StringReader(sb.ToString())) { using (var reader = new JsonTextReader(stringReader)) { yield return(converter.ReadOne(reader)); } } sb.Clear(); } else { sb.AppendLine(line); } } } }
public static IEnumerable <DynamicData> ReadAsArray(this Json2SquidexConverter converter, Stream stream) { using (var streamReader = new StreamReader(stream)) { using (var reader = new JsonTextReader(streamReader)) { foreach (var data in converter.ReadAll(reader)) { yield return(data); } } } }