Created
August 14, 2020 08:45
-
-
Save lucamauri/ac9b93287e085f41799b7eeb1fa7335b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim Options = New JsonWriterOptions | |
With options | |
.Indented = True | |
End With | |
Dim MemStream As New MemoryStream | |
Dim Writer As New Utf8JsonWriter(MemStream, Options) | |
Writer.WriteStartObject() | |
Writer.WriteString("date", DateTimeOffset.UtcNow) | |
Writer.WriteNumber("temp", 42) | |
Writer.WriteEndObject() | |
Console.WriteLine(Writer.BytesPending) | |
Writer.Flush() | |
Console.WriteLine(MemStream.Length) | |
MemStream.Close() | |
Dim JSON As String = Encoding.UTF8.GetString(MemStream.ToArray()) | |
Console.WriteLine(Json) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment