using System.Json; JsonObject person = new JsonObject(); person["name"] = "John"; person["age"] = 25; person["isMarried"] = true;
using System.Json; string json = @"{ ""name"": ""John"", ""age"": 25, ""isMarried"": true }"; JsonObject person = JsonObject.Parse(json);
using System.Json; string json = @"[ { ""name"": ""John"", ""age"": 25, ""isMarried"": true }, { ""name"": ""Jane"", ""age"": 30, ""isMarried"": false } ]"; JsonArray people = JsonArray.Parse(json); JsonObject person = people[0] as JsonObject;In this example, we are accessing elements of a JSON array. We are using the indexing operator to access the first element of the array, which is a JSON object. The C# JSONValue class is part of the System.Json namespace, which is included in the System.Json.dll assembly. This assembly is a part of the .NET Framework and is available in all versions of the framework since version 4.0.