4 instantiations of JsonDocument
System.Text.Json (4)
1091 references to JsonDocument
aspire (68)
DotNet\DotNetCliRunner.cs (4)
34Task<(int ExitCode, JsonDocument? Output)> GetProjectItemsAndPropertiesAsync(FileInfo projectFile, string[] items, string[] properties, string[] targets, ProcessInvocationOptions options, CancellationToken cancellationToken);
785public async Task<(int ExitCode, JsonDocument? Output)> GetProjectItemsAndPropertiesAsync(FileInfo projectFile, string[] items, string[] properties, string[] targets, ProcessInvocationOptions options, CancellationToken cancellationToken)
901var json = JsonDocument.Parse(stdout);
Projects\ProjectUpdater.cs (7)
306private async Task<JsonDocument> GetItemsAndPropertiesAsync(FileInfo projectFile, CancellationToken cancellationToken)
311private async Task<JsonDocument> GetItemsAndPropertiesAsync(FileInfo projectFile, string[] items, string[] properties, CancellationToken cancellationToken)
331private async Task<JsonDocument> GetItemsAndPropertiesWithFallbackAsync(FileInfo projectFile, UpdateContext context, CancellationToken cancellationToken)
336private async Task<JsonDocument> GetItemsAndPropertiesWithFallbackAsync(FileInfo projectFile, string[] items, string[] properties, UpdateContext context, CancellationToken cancellationToken)
409var itemsAndPropertiesDocument = await GetItemsAndPropertiesWithFallbackAsync(context.AppHostProjectFile, context, cancellationToken);
944var itemsAndPropertiesDocument = IsAppHostProject(projectFile, context.AppHostProjectFile)
1185var document = await GetItemsAndPropertiesAsync(
aspire-managed (4)
Aspire.Acquisition.Tests (10)
Aspire.Cli.EndToEnd.Tests (48)
Aspire.Cli.Tests (292)
Commands\DoctorCommandTests.cs (26)
41using var doc = await RunDoctorJsonAsync(workspace,
65using var doc = await RunDoctorJsonAsync(workspace,
92using var doc = await RunDoctorJsonAsync(workspace,
155using var doc = JsonDocument.Parse(stdoutText);
169using var doc = await RunDoctorJsonAsync(workspace,
206using var doc = await RunDoctorJsonAsync(workspace,
246using var doc = await RunDoctorJsonAsync(workspace,
273using var doc = await RunDoctorJsonAsync(workspace,
303using var doc = await RunDoctorJsonAsync(workspace,
327using var doc = await RunDoctorJsonAsync(workspace,
353using var doc = await RunDoctorJsonAsync(workspace,
382using var doc = await RunDoctorJsonAsync(workspace,
416using var doc = await RunDoctorJsonAsync(workspace,
445using var doc = await RunDoctorJsonAsync(workspace,
469using var doc = await RunDoctorJsonAsync(workspace,
505using var doc = await RunDoctorJsonAsync(workspace,
539using var doc = await RunDoctorJsonAsync(workspace,
564using var doc = await RunDoctorJsonAsync(workspace,
588using var doc = await RunDoctorJsonAsync(workspace,
629using var doc = await RunDoctorJsonAsync(workspace,
873using var doc = await RunDoctorJsonAsync(workspace,
907using var doc = await RunDoctorJsonAsync(workspace,
1007private async Task<JsonDocument> RunDoctorJsonAsync(
1028return JsonDocument.Parse(stdoutText);
1031private static JsonElement GetCheckByName(JsonDocument document, string checkName)
Projects\DotNetAppHostProjectTests.cs (17)
446return (0, JsonDocument.Parse($$"""
834return (0, JsonDocument.Parse($$"""
897return (0, JsonDocument.Parse($$"""
953return (0, JsonDocument.Parse($$"""
1033return (0, JsonDocument.Parse($$"""
1511return (0, JsonDocument.Parse($$"""
1667return (0, JsonDocument.Parse($$"""
1777return (0, JsonDocument.Parse($$"""
1840return (0, JsonDocument.Parse($$"""
1903return (0, JsonDocument.Parse($$"""
1964return (0, JsonDocument.Parse($$"""
2024return (0, JsonDocument.Parse($$"""
2090return (0, JsonDocument.Parse($$"""
2147return (0, JsonDocument.Parse("""
2888Func<JsonDocument> createAppHostInfo,
4493private static JsonDocument CreateAppHostInfoJson(
4513return JsonDocument.Parse(JsonSerializer.Serialize(new { Properties = properties, Items = new { } }));
TestServices\TestDotNetCliRunner.cs (9)
21public Func<FileInfo, string[], string[], string[], ProcessInvocationOptions, CancellationToken, Task<(int ExitCode, JsonDocument? Output)>>? GetProjectItemsAndPropertiesAsyncCallbackWithTargetsAsync { get; set; }
22public Func<FileInfo, string[], string[], string[], ProcessInvocationOptions, CancellationToken, (int ExitCode, JsonDocument? Output)>? GetProjectItemsAndPropertiesAsyncCallbackWithTargets { get; set; }
23public Func<FileInfo, string[], string[], ProcessInvocationOptions, CancellationToken, Task<(int ExitCode, JsonDocument? Output)>>? GetProjectItemsAndPropertiesAsyncCallbackAsync { get; set; }
24public Func<FileInfo, string[], string[], ProcessInvocationOptions, CancellationToken, (int ExitCode, JsonDocument? Output)>? GetProjectItemsAndPropertiesAsyncCallback { get; set; }
96public Task<(int ExitCode, JsonDocument? Output)> GetProjectItemsAndPropertiesAsync(FileInfo projectFile, string[] items, string[] properties, string[] targets, ProcessInvocationOptions options, CancellationToken cancellationToken)
136return Task.FromResult<(int, JsonDocument?)>((exitCode, JsonDocument.Parse(json)));
151return Task.FromResult<(int, JsonDocument?)>((0, JsonDocument.Parse(defaultJson)));
Aspire.Components.Common.TestUtilities (4)
Aspire.Dashboard (2)
Aspire.Dashboard.Tests (23)
Aspire.Deployment.EndToEnd.Tests (12)
Aspire.Hosting (12)
Aspire.Hosting.Azure (2)
Aspire.Hosting.Azure.Tests (14)
Aspire.Hosting.Blazor (2)
Aspire.Hosting.Browsers (4)
Aspire.Hosting.Browsers.Tests (15)
Aspire.Hosting.CodeGeneration.TypeScript (2)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (4)
Aspire.Hosting.DevTunnels (1)
Aspire.Hosting.Dotnet (2)
Aspire.Hosting.EntityFrameworkCore (2)
Aspire.Hosting.Foundry (12)
Aspire.Hosting.Java.Tests (2)
Aspire.Hosting.JavaScript (2)
Aspire.Hosting.JavaScript.Tests (2)
Aspire.Hosting.Kubernetes (12)
Aspire.Hosting.Maui (2)
Aspire.Hosting.OpenAI (2)
Aspire.Hosting.PostgreSQL.Tests (2)
Aspire.Hosting.Radius (8)
Aspire.Hosting.Radius.Tests (4)
Aspire.Hosting.RemoteHost (2)
Aspire.Hosting.RemoteHost.Tests (8)
Aspire.Hosting.Rust (2)
Aspire.Hosting.Sdk.Tests (2)
Aspire.Hosting.Seq.Tests (2)
Aspire.Hosting.Tests (37)
Aspire.Hosting.TestUtilities (6)
Aspire.Templates.Tests (2)
Aspire.TestTools (9)
Aspire.TypeSystem (1)
dotnet-aot (7)
dotnet-openapi (2)
dotnet-sourcelink (1)
dotnet-user-jwts (2)
ILCompiler.Compiler (2)
ILCompiler.ReadyToRun (2)
Infrastructure.Tests (40)
Microsoft.AspNetCore.Authentication (1)
Microsoft.AspNetCore.Authentication.Facebook (2)
Microsoft.AspNetCore.Authentication.Google (2)
Microsoft.AspNetCore.Authentication.MicrosoftAccount (2)
Microsoft.AspNetCore.Authentication.OAuth (8)
Microsoft.AspNetCore.Authentication.OpenIdConnect (8)
Microsoft.AspNetCore.Authentication.Twitter (5)
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Microsoft.AspNetCore.JsonPatch.SystemTextJson (2)
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
Microsoft.Build (2)
Microsoft.CodeAnalysis.Features (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
Microsoft.Deployment.DotNet.Releases (4)
Microsoft.DotNet.Arcade.Sdk (2)
Microsoft.DotNet.ProjectTools (2)
Microsoft.Extensions.AI (1)
Microsoft.Extensions.AI.Abstractions (8)
Functions\AIFunctionFactory.cs (7)
96/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
177/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
267/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
356/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
419/// <see cref="JsonDocument"/>, or <see cref="JsonNode"/>, it is deserialized directly. If the argument is anything else unknown,
459/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
974JsonDocument doc => JsonSerializer.Deserialize(doc, typeInfo),
Microsoft.Extensions.AI.Abstractions.Tests (37)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (3)
Microsoft.Extensions.AI.Evaluation.Safety (10)
Microsoft.Extensions.AI.OpenAI (6)
Microsoft.Extensions.AI.OpenAI.Tests (15)
Microsoft.Extensions.AI.Tests (11)
Microsoft.Extensions.Configuration.Json (2)
Microsoft.ML.Tokenizers (2)
Microsoft.ML.Tokenizers.Tests (4)
Microsoft.NET.Build.Containers (6)
Microsoft.NET.HostModel (1)
Microsoft.SourceLink.Tools.Package (1)
Microsoft.TemplateEngine.Edge (6)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (6)
Microsoft.TemplateEngine.Utils (6)
Microsoft.TemplateSearch.Common (6)
Microsoft.TestPlatform.CommunicationUtilities (41)
Microsoft.TestPlatform.TestHostRuntimeProvider (2)
NuGet.Protocol (6)
RepoTasks (2)
rzc (2)
Shared.Tests (5)
System.Text.Json (155)
System\Text\Json\Document\JsonDocument.Parse.cs (27)
16private static JsonDocument? s_nullLiteral;
17private static JsonDocument? s_trueLiteral;
18private static JsonDocument? s_falseLiteral;
47public static JsonDocument Parse(ReadOnlyMemory<byte> utf8Json, JsonDocumentOptions options = default)
77public static JsonDocument Parse(ReadOnlySequence<byte> utf8Json, JsonDocumentOptions options = default)
122public static JsonDocument Parse(Stream utf8Json, JsonDocumentOptions options = default)
145internal static JsonDocument ParseRented(PooledByteBufferWriter utf8Json, JsonDocumentOptions options = default)
155internal static JsonDocument ParseValue(Stream utf8Json, JsonDocumentOptions options)
175internal static JsonDocument ParseValue(ReadOnlySpan<byte> utf8Json, JsonDocumentOptions options)
186internal static JsonDocument ParseValue(string json, JsonDocumentOptions options)
208public static Task<JsonDocument> ParseAsync(
218private static async Task<JsonDocument> ParseAsyncCore(
242internal static async Task<JsonDocument> ParseAsyncCoreUnrented(
282public static JsonDocument Parse([StringSyntax(StringSyntaxAttribute.Json)] ReadOnlyMemory<char> json, JsonDocumentOptions options = default)
308internal static JsonDocument ParseValue(ReadOnlySpan<char> json, JsonDocumentOptions options)
349public static JsonDocument Parse([StringSyntax(StringSyntaxAttribute.Json)] string json, JsonDocumentOptions options = default)
394public static bool TryParseValue(ref Utf8JsonReader reader, [NotNullWhen(true)] out JsonDocument? document)
434public static JsonDocument ParseValue(ref Utf8JsonReader reader) =>
437internal static JsonDocument ParseValue(ref Utf8JsonReader reader, bool allowDuplicateProperties)
439bool ret = TryParseValue(ref reader, out JsonDocument? document, shouldThrow: true, useArrayPools: true, allowDuplicateProperties);
448[NotNullWhen(true)] out JsonDocument? document,
692private static JsonDocument CreateForLiteral(JsonTokenType tokenType)
708JsonDocument Create(byte[] utf8Json)
716private static JsonDocument Parse(
726JsonDocument document;
753private static JsonDocument ParseUnrented(
787JsonDocument document = new JsonDocument(utf8Json, database, isDisposable: false);
System\Text\Json\Document\JsonElement.Parse.cs (14)
49bool ret = JsonDocument.TryParseValue(ref reader, out JsonDocument? document, shouldThrow: true, useArrayPools: false);
58bool ret = JsonDocument.TryParseValue(
60out JsonDocument? document,
72JsonDocument document = JsonDocument.ParseValue(utf8Json, options);
86JsonDocument document = JsonDocument.ParseValue(utf8Json, options);
100JsonDocument document = JsonDocument.ParseValue(json, options);
117JsonDocument document = JsonDocument.ParseValue(json, options);
161bool ret = JsonDocument.TryParseValue(ref reader, out JsonDocument? document, shouldThrow: false, useArrayPools: false);
System\Text\Json\Serialization\JsonSerializer.Write.Document.cs (19)
14/// Converts the provided value into a <see cref="JsonDocument"/>.
17/// <returns>A <see cref="JsonDocument"/> representation of the JSON value.</returns>
26public static JsonDocument SerializeToDocument<TValue>(TValue value, JsonSerializerOptions? options = null)
33/// Converts the provided value into a <see cref="JsonDocument"/>.
35/// <returns>A <see cref="JsonDocument"/> representation of the value.</returns>
51public static JsonDocument SerializeToDocument(object? value, Type inputType, JsonSerializerOptions? options = null)
59/// Converts the provided value into a <see cref="JsonDocument"/>.
62/// <returns>A <see cref="JsonDocument"/> representation of the value.</returns>
68public static JsonDocument SerializeToDocument<TValue>(TValue value, JsonTypeInfo<TValue> jsonTypeInfo)
77/// Converts the provided value into a <see cref="JsonDocument"/>.
79/// <returns>A <see cref="JsonDocument"/> representation of the value.</returns>
88public static JsonDocument SerializeToDocument(object? value, JsonTypeInfo jsonTypeInfo)
97/// Converts the provided value into a <see cref="JsonDocument"/>.
99/// <returns>A <see cref="JsonDocument"/> representation of the value.</returns>
114public static JsonDocument SerializeToDocument(object? value, Type inputType, JsonSerializerContext context)
122private static JsonDocument WriteDocument<TValue>(in TValue value, JsonTypeInfo<TValue> jsonTypeInfo)
135return JsonDocument.ParseRented(output, options.GetDocumentOptions());
143private static JsonDocument WriteDocumentAsObject(object? value, JsonTypeInfo jsonTypeInfo)
156return JsonDocument.ParseRented(output, options.GetDocumentOptions());