CKTIS / C#
System.Text.Json.Nodes.JsonNode: praktická reference
System.Text.Json.Nodes.JsonNode: praktická reference: JsonNode představuje měnitelný strom JSON z objektů, polí a hodnot.
Verze: .NET API; verified against .NET 10 reference surface
Syntaxe
System.Text.Json.Nodes.JsonNode /* select a documented member or constructor */JsonNode představuje měnitelný strom JSON z objektů, polí a hodnot.
Použijte pro cílené změny dokumentu bez statického modelu.
Uzel má jednoho rodiče; opětovné použití jinde vyžaduje klon.
Parse může pro literál null vrátit null; přístup s chybným typem vyhodí výjimku.
Úplný program skutečně používá System.Text.Json.Nodes.JsonNode; přesně očekávaný stdout je 4.
Příklady
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
var node = JsonNode.Parse("{\"x\":4}")!;
Console.WriteLine(node["x"]!.GetValue<int>());
Výsledek
4
Úplný program skutečně používá `System.Text.Json.Nodes.JsonNode`; přesně očekávaný stdout je `4`.