C# by Nélio

JSON parse in C#

The JsonDocument.Parse parses a stream as UTF-8-encoded data representing a single JSON value into a JsonDocument. The stream is read to completion.

using System.Text.Json;

string data = @" [ {""name"": ""Krish Jackon"", ""phoneNumber"": ""123456""}, 
    {""name"": ""Marc Moore"", ""phoneNumber"": ""654321""} ]";

using JsonDocument doc = JsonDocument.Parse(data);
JsonElement root = doc.RootElement;

Comments

Leave a Comment

All fields are required. Your email address will not be published.