/// <summary>
        /// Executes the query and returns a JSON string from data set returned by the query asynchronously.
        /// </summary>
        /// <param name="dataCommand">The data command.</param>
        /// <param name="options">The <see cref="JsonWriterOptions"/> options.</param>
        /// <returns>A JSON string representing the <see cref="IDataReader"/> result of the command.</returns>
        public static async Task <string> QueryJsonAsync(this IDataCommand dataCommand, JsonWriterOptions options = default)
        {
            using var stream       = new MemoryStream();
            await using var writer = new Utf8JsonWriter(stream, options);

            writer.WriteStartArray();

            await dataCommand.ReadAsync(reader =>
            {
                while (reader.Read())
                {
                    writer.WriteStartObject();

                    for (int index = 0; index < reader.FieldCount; index++)
                    {
                        var name = reader.GetName(index);
                        writer.WritePropertyName(name);

                        WriteValue(reader, writer, index);
                    }

                    writer.WriteEndObject();
                }
            });

            writer.WriteEndArray();

            await writer.FlushAsync();

            return(Encoding.UTF8.GetString(stream.ToArray()));
        }