// read next array element (with String type) by memorizing the positions public int NextString(out string stringValue, out int progressVal) { stringValue = string.Empty; progressVal = 0; int retVal = -1; if (EndOfJSON) { return(retVal); } var reader = new Utf8JsonReader(JsonBuffer.Slice(BuffPosition), isFinalBlock: false, CurPosition); while (reader.TokenType != JsonTokenType.EndArray) { reader.Read(); if (reader.TokenType == JsonTokenType.String) { stringValue = reader.GetString(); } else if (reader.TokenType == JsonTokenType.EndArray) { EndOfJSON = true; break; } else { continue; } retVal = 0; BuffPosition = JsonBuffer.GetPosition(reader.BytesConsumed, BuffPosition); CurPosition = reader.CurrentState; progressVal = (int)(100 * BuffPosition.GetInteger() / MaxBuffSize); break; } return(retVal); }