4 instantiations of JsonDocument
System.Text.Json (4)
System\Text\Json\Document\JsonDocument.cs (1)
719new JsonDocument(
System\Text\Json\Document\JsonDocument.Parse.cs (3)
712return new JsonDocument(utf8Json, database, isDisposable: false); 731document = new JsonDocument(utf8Json, database, extraRentedArrayPoolBytes, extraPooledByteBufferWriter, isDisposable: true); 789JsonDocument document = new JsonDocument(utf8Json, database, isDisposable: false);
532 references to JsonDocument
aspire (30)
DotNet\DotNetCliRunner.cs (4)
31Task<(int ExitCode, JsonDocument? Output)> GetProjectItemsAndPropertiesAsync(FileInfo projectFile, string[] items, string[] properties, DotNetCliRunnerInvocationOptions options, CancellationToken cancellationToken); 159public async Task<(int ExitCode, JsonDocument? Output)> GetProjectItemsAndPropertiesAsync(FileInfo projectFile, string[] items, string[] properties, DotNetCliRunnerInvocationOptions options, CancellationToken cancellationToken) 227var json = JsonDocument.Parse(stdout!);
Mcp\ExecuteResourceCommandTool.cs (1)
18return JsonDocument.Parse("""
Mcp\GetIntegrationDocsTool.cs (1)
20return JsonDocument.Parse("""
Mcp\ListAppHostsTool.cs (1)
35return JsonDocument.Parse("{ \"type\": \"object\", \"properties\": {} }").RootElement;
Mcp\ListConsoleLogsTool.cs (1)
18return JsonDocument.Parse("""
Mcp\ListIntegrationsTool.cs (1)
60return JsonDocument.Parse("""
Mcp\ListResourcesTool.cs (1)
18return JsonDocument.Parse("{ \"type\": \"object\", \"properties\": {} }").RootElement;
Mcp\ListStructuredLogsTool.cs (1)
18return JsonDocument.Parse("""
Mcp\ListTracesTool.cs (1)
18return JsonDocument.Parse("""
Mcp\ListTraceStructuredLogsTool.cs (1)
18return JsonDocument.Parse("""
Mcp\SelectAppHostTool.cs (1)
21return JsonDocument.Parse("""
Projects\FallbackProjectParser.cs (5)
37public JsonDocument ParseProject(FileInfo projectFile) 72private static JsonDocument ParseCsprojProjectFile(FileInfo projectFile) 97private static JsonDocument ParseCsAppHostFile(FileInfo projectFile) 116private static JsonDocument BuildJsonDocument( 159return JsonDocument.Parse(rootObject.ToJsonString());
Projects\ProjectLocator.cs (2)
178var json = await JsonDocument.ParseAsync(stream, cancellationToken: cancellationToken);
Projects\ProjectUpdater.cs (7)
165private async Task<JsonDocument> GetItemsAndPropertiesAsync(FileInfo projectFile, CancellationToken cancellationToken) 170private async Task<JsonDocument> GetItemsAndPropertiesAsync(FileInfo projectFile, string[] items, string[] properties, CancellationToken cancellationToken) 190private async Task<JsonDocument> GetItemsAndPropertiesWithFallbackAsync(FileInfo projectFile, UpdateContext context, CancellationToken cancellationToken) 195private async Task<JsonDocument> GetItemsAndPropertiesWithFallbackAsync(FileInfo projectFile, string[] items, string[] properties, UpdateContext context, CancellationToken cancellationToken) 254var itemsAndPropertiesDocument = await GetItemsAndPropertiesWithFallbackAsync(context.AppHostProjectFile, context, cancellationToken); 544var itemsAndPropertiesDocument = IsAppHostProject(projectFile, context) 773var document = await GetItemsAndPropertiesAsync(
src\Shared\PackageUpdateHelpers.cs (2)
132using var document = JsonDocument.Parse(stdout);
Aspire.Cli.Tests (64)
Mcp\ListIntegrationsToolTests.cs (6)
60using var json = JsonDocument.Parse(textContent.Text); 85using var json = JsonDocument.Parse(textContent.Text); 119using var json = JsonDocument.Parse(((ModelContextProtocol.Protocol.TextContentBlock)result.Content![0]).Text);
Projects\FallbackProjectParserTests.cs (13)
15private static string FormatJson(JsonDocument document) 36var result = parser.ParseProject(new FileInfo(projectFile)); 61var result = parser.ParseProject(new FileInfo(projectFile)); 86var result = parser.ParseProject(new FileInfo(projectFile)); 111var result = parser.ParseProject(new FileInfo(projectFile)); 137var result = parser.ParseProject(new FileInfo(projectFile)); 163var result = parser.ParseProject(new FileInfo(projectFile)); 222var result = parser.ParseProject(new FileInfo(projectFile)); 252var result = parser.ParseProject(new FileInfo(projectFile)); 275var result = parser.ParseProject(new FileInfo(projectFile)); 299var result = parser.ParseProject(new FileInfo(projectFile)); 322var result = parser.ParseProject(new FileInfo(projectFile)); 344var result = parser.ParseProject(new FileInfo(projectFile));
Projects\ProjectLocatorTests.cs (4)
953return (0, JsonDocument.Parse(json)); 988return (0, JsonDocument.Parse(json)); 1027return (0, JsonDocument.Parse(json)); 1094return (0, JsonDocument.Parse(json));
Projects\ProjectUpdaterTests.cs (38)
94var document = JsonDocument.Parse(json); 205var document = JsonDocument.Parse(json); 344var document = JsonDocument.Parse(json); 497var document = JsonDocument.Parse(json); 641var document = JsonDocument.Parse(json); 746var document = JsonDocument.Parse(json); 848var document = JsonDocument.Parse(json); 992var document = JsonDocument.Parse(json); 1115var document = JsonDocument.Parse(json); 1229var document = JsonDocument.Parse(json); 1339var document = JsonDocument.Parse(json); 1705var document = JsonDocument.Parse(json); 1779var document = JsonDocument.Parse(json); 1862var document = JsonDocument.Parse(json); 1945var document = JsonDocument.Parse(json); 2032var document = JsonDocument.Parse(json); 2111var document = JsonDocument.Parse(json); 2195var document = JsonDocument.Parse(json); 2324var document = JsonDocument.Parse(json);
Templating\DotNetTemplateFactoryTests.cs (1)
462public Task<(int ExitCode, JsonDocument? Output)> GetProjectItemsAndPropertiesAsync(FileInfo projectFile, string[] items, string[] properties, DotNetCliRunnerInvocationOptions options, CancellationToken cancellationToken)
TestServices\TestDotNetCliRunner.cs (2)
20public Func<FileInfo, string[], string[], DotNetCliRunnerInvocationOptions, CancellationToken, (int ExitCode, JsonDocument? Output)>? GetProjectItemsAndPropertiesAsyncCallback { get; set; } 82public Task<(int ExitCode, JsonDocument? Output)> GetProjectItemsAndPropertiesAsync(FileInfo projectFile, string[] items, string[] properties, DotNetCliRunnerInvocationOptions options, CancellationToken cancellationToken)
Aspire.Dashboard (2)
Model\GenAI\GenAIMessages.cs (2)
107using var doc = JsonDocument.ParseValue(ref reader);
Aspire.Dashboard.Tests (5)
DashboardOptionsTests.cs (5)
319var jsonElement = JsonDocument.Parse(""" 347var jsonElement = JsonDocument.Parse(""" 376var jsonElement = JsonDocument.Parse(""" 412var jsonElement = JsonDocument.Parse(""" 451var jsonElement = JsonDocument.Parse("""
Aspire.Hosting (4)
Dcp\DcpLogParser.cs (2)
142using var doc = JsonDocument.Parse(jsonPart);
src\Shared\PackageUpdateHelpers.cs (2)
132using var document = JsonDocument.Parse(stdout);
Aspire.Hosting.DevTunnels (1)
DevTunnelCliClient.cs (1)
300output = JsonDocument.Parse(output).RootElement.GetProperty(propertyName).GetRawText();
Aspire.Hosting.JavaScript (2)
JavaScriptHostingExtensions.cs (2)
977using var packageJson = JsonDocument.Parse(stream);
Aspire.Hosting.Maui (2)
Utilities\ProjectFileReader.cs (2)
85var jsonDoc = JsonDocument.Parse(output);
Aspire.Hosting.OpenAI (2)
OpenAIHealthCheck.cs (2)
91using var doc = await JsonDocument.ParseAsync(stream, cancellationToken: cts.Token).ConfigureAwait(false);
Aspire.Hosting.PostgreSQL.Tests (2)
AddPostgresTests.cs (2)
484var document = JsonDocument.Parse(serversFile.Contents!);
Aspire.Hosting.Seq.Tests (2)
SeqFunctionalTests.cs (2)
62var jsonDocument = JsonDocument.Parse(reponseContent);
Aspire.Hosting.Tests (7)
Helpers\JsonDocumentManifestPublisher.cs (6)
31_manifestDocument = await JsonDocument.ParseAsync(stream, cancellationToken: cancellationToken).ConfigureAwait(false); 34private JsonDocument? _manifestDocument; 36public JsonDocument ManifestDocument 50private JsonDocument? _manifestDocument; 52public JsonDocument ManifestDocument 89manifestStore.ManifestDocument = await JsonDocument.ParseAsync(stream, cancellationToken: context.CancellationToken).ConfigureAwait(false);
Schema\SchemaTests.cs (1)
246var manifestDocument = manifestStore.ManifestDocument;
dotnet-openapi (2)
Commands\BaseCommand.cs (2)
463using var packageVersionDocument = await JsonDocument.ParseAsync(packageVersionStream);
dotnet-user-jwts (2)
Helpers\DevJwtCliHelpers.cs (2)
82var launchSettingsJson = JsonDocument.Parse(launchSettingsFileStream);
JwtBearerSample (2)
Startup.cs (2)
77using (var json = JsonDocument.Parse(body))
Microsoft.AspNetCore.Authentication (1)
JsonDocumentAuthExtensions.cs (1)
9/// Authentication extensions to <see cref="JsonDocument"/>.
Microsoft.AspNetCore.Authentication.Facebook (2)
FacebookHandler.cs (2)
58using (var payload = JsonDocument.Parse(await response.Content.ReadAsStringAsync(Context.RequestAborted)))
Microsoft.AspNetCore.Authentication.Google (2)
GoogleHandler.cs (2)
56using (var payload = JsonDocument.Parse(await response.Content.ReadAsStringAsync(Context.RequestAborted)))
Microsoft.AspNetCore.Authentication.MicrosoftAccount (2)
MicrosoftAccountHandler.cs (2)
52using (var payload = JsonDocument.Parse(await response.Content.ReadAsStringAsync(Context.RequestAborted)))
Microsoft.AspNetCore.Authentication.OAuth (8)
OAuthHandler.cs (4)
227true => OAuthTokenResponse.Success(JsonDocument.Parse(body)), 234var exception = OAuthTokenResponse.GetStandardErrorException(JsonDocument.Parse(body)); 254using (var user = JsonDocument.Parse("{}"))
OAuthTokenResponse.cs (4)
18private OAuthTokenResponse(JsonDocument response) 39public static OAuthTokenResponse Success(JsonDocument response) 63public JsonDocument? Response { get; set; } 93internal static Exception? GetStandardErrorException(JsonDocument response)
Microsoft.AspNetCore.Authentication.OpenIdConnect (8)
Events\UserInformationReceivedContext.cs (1)
32public JsonDocument User { get; set; } = default!;
OpenIdConnectHandler.cs (7)
912using (var payload = JsonDocument.Parse("{}")) 1060JsonDocument user; 1064user = JsonDocument.Parse(userInfoResponse); 1069user = JsonDocument.Parse(userInfoEndpointJwt.Payload.SerializeToJson()); 1085using (var updatedUser = userInformationReceivedContext.User) 1329private async Task<UserInformationReceivedContext> RunUserInformationReceivedEventAsync(ClaimsPrincipal principal, AuthenticationProperties properties, OpenIdConnectMessage message, JsonDocument user)
Microsoft.AspNetCore.Authentication.Test (28)
ClaimActionTests.cs (14)
15var userData = JsonDocument.Parse("{ \"name\": \"test\" }"); 29var userData = JsonDocument.Parse("{ \"role\": [ \"role1\", null, \"role2\" ] }"); 47var userData = JsonDocument.Parse("{ \"name\": { \"subkey\": \"test\" } }"); 61var userData = JsonDocument.Parse("{ \"role\": { \"subkey\": [ \"role1\", null, \"role2\" ] } }"); 79var userData = JsonDocument.Parse("{ \"name0\": \"value0\", \"name1\": \"value1\" }"); 94var userData = JsonDocument.Parse("{ \"name0\": \"value0\", \"name1\": \"value1\" }"); 109var userData = JsonDocument.Parse("{ \"name0\": \"value0\", \"name1\": \"value1\" }");
JsonDocumentAuthExtensionsTests.cs (2)
18using (var document = JsonDocument.Parse(json))
JwtBearerTests.cs (4)
953using var dom = JsonDocument.Parse(responseBody); 997using var dom = JsonDocument.Parse(responseBody);
JwtBearerTests_Handler.cs (4)
898using var dom = JsonDocument.Parse(responseBody); 941using var dom = JsonDocument.Parse(responseBody);
OpenIdConnect\UniqueJsonKeyClaimActionTests.cs (4)
15var userData = JsonDocument.Parse("{ \"jsonKey\": \"value\" }"); 31var userData = JsonDocument.Parse("{ \"jsonKey\": \"value\" }");
Microsoft.AspNetCore.Authentication.Twitter (5)
TwitterHandler.cs (5)
116JsonDocument user; 123user = JsonDocument.Parse("{}"); 320private async Task<JsonDocument> RetrieveUserDetailsAsync(AccessToken accessToken) 333var result = JsonDocument.Parse(responseText);
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
TargetPickerUi.cs (1)
149var res = System.Text.Json.JsonDocument.Parse(await ReceiveMessageLoop(browserDebugClientConnect, token)).RootElement;
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Internal\Json\AnyConverter.cs (2)
23using var d = JsonDocument.ParseValue(ref reader);
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (56)
ConverterTests\JsonConverterWriteTests.cs (4)
618using var doc1 = JsonDocument.Parse(jsonNew); 619using var doc2 = JsonDocument.Parse(jsonOld);
ServerStreamingServerCallHandlerTests.cs (14)
68using var responseJson1 = JsonDocument.Parse(line1!); 75using var responseJson2 = JsonDocument.Parse(line2!); 112using var responseJson1 = JsonDocument.Parse(line1!); 116using var responseJson2 = JsonDocument.Parse(line2!); 154using var responseJson1 = JsonDocument.Parse(line1!); 158using var responseJson2 = JsonDocument.Parse(line2!); 195using var responseJson = JsonDocument.Parse(line!);
UnaryServerCallHandlerTests.cs (38)
82using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 120using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 180using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 717using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 749using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 787using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 817using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 841using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 866using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 933using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 1011using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 1053using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 1083using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 1112using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 1155using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 1209using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 1236using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 1475using var responseJson = JsonDocument.Parse(httpContext.Response.Body); 1736using var responseJson = JsonDocument.Parse(httpContext.Response.Body);
Microsoft.AspNetCore.Http.Abstractions.Tests (2)
HttpValidationProblemDetailsJsonConverterTest.cs (2)
34var document = JsonDocument.Parse(ms);
Microsoft.AspNetCore.JsonPatch.SystemTextJson (2)
Helpers\JsonUtilities.cs (1)
44var docA = JsonSerializer.SerializeToDocument(item, serializerOptions);
Internal\ConversionResultProvider.cs (1)
82using JsonDocument doc = JsonSerializer.SerializeToDocument(value, serializerOptions);
Microsoft.AspNetCore.JsonPatch.SystemTextJson.Tests (2)
IntegrationTests\HeterogenousCollectionTests.cs (2)
91using var doc = JsonDocument.ParseValue(ref reader);
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
Infrastructure\DefaultTempDataSerializer.cs (2)
20using var jsonDocument = JsonDocument.Parse(value);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
HttpsTests.cs (1)
162var result = System.Text.Json.JsonDocument.Parse(response).RootElement;
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
StringCopyPaste\StringCopyPasteData.cs (1)
48var value = JsonSerializer.Deserialize(JsonDocument.Parse(json), typeof(StringCopyPasteData));
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
EmbeddedLanguages\Json\CSharpJsonParserTests.cs (1)
205JsonDocument.Parse(token.ValueText, new JsonDocumentOptions { AllowTrailingCommas = false, CommentHandling = JsonCommentHandling.Disallow });
Microsoft.CodeAnalysis.Features (2)
EmbeddedLanguages\Json\LanguageServices\JsonLanguageDetector.cs (1)
148options = symbol.ContainingType.Name == nameof(JsonDocument) ? JsonOptions.Strict : default;
PdbSourceDocument\SourceLinkMap.cs (1)
72var root = JsonDocument.Parse(json, new JsonDocumentOptions() { AllowTrailingCommas = true }).RootElement;
Microsoft.CodeAnalysis.LanguageServer.Protocol (7)
Protocol\Converters\ParameterInformationConverter.cs (2)
18using var document = JsonDocument.ParseValue(ref reader);
Protocol\Converters\SumConverter.cs (2)
206using var document = JsonDocument.ParseValue(ref reader);
Protocol\Internal\Converters\ClassifiedTextRunConverter.cs (1)
20var data = JsonDocument.ParseValue(ref reader).RootElement;
Protocol\Internal\Converters\ObjectContentConverter.cs (2)
48using var jsonDocument = JsonDocument.ParseValue(ref reader);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (6)
UriTests.cs (6)
178var jsonDocument = JsonDocument.Parse(requestJson); 229var jsonDocument = JsonDocument.Parse(requestJson); 275var jsonDocument = JsonDocument.Parse(requestJson);
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
MSBuild\SolutionFileReader.SolutionFilterReader.cs (2)
27using var document = JsonDocument.Parse(File.ReadAllText(filterFilename));
Microsoft.DotNet.Arcade.Sdk (2)
src\InstallDotNetCore.cs (2)
59using (JsonDocument jsonDocument = JsonDocument.Parse(bytes))
Microsoft.Extensions.AI (1)
ChatCompletion\ChatResponse{T}.cs (1)
139if (JsonDocument.Parse(json!).RootElement.TryGetProperty("data", out var data))
Microsoft.Extensions.AI.Abstractions (8)
Functions\AIFunctionFactory.cs (7)
88/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>, 167/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>, 258/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>, 344/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>, 402/// <see cref="JsonDocument"/>, or <see cref="JsonNode"/>, it is deserialized directly. If the argument is anything else unknown, 448/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>, 874JsonDocument doc => JsonSerializer.Deserialize(doc, typeInfo),
Utilities\AIJsonUtilities.Defaults.cs (1)
82[JsonSerializable(typeof(JsonDocument))]
Microsoft.Extensions.AI.Abstractions.Tests (37)
ChatCompletion\ChatResponseFormatTests.cs (1)
17private static JsonElement EmptySchema => JsonDocument.Parse("{}").RootElement;
Contents\FunctionCallContentTests.cs (2)
153var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonDocument>>(""" 195AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string, JsonDocument>>("""
test\Shared\JsonSchemaExporter\TestTypes.cs (5)
101yield return new TestData<JsonDocument>(JsonDocument.Parse("""[{ "x" : 42 }]"""), "true"); 102yield return new TestData<JsonElement>(JsonDocument.Parse("""[{ "x" : 42 }]""").RootElement, "true"); 118yield return new TestData<JsonElement?>(JsonDocument.Parse("{}").RootElement, "true"); 1245[JsonSerializable(typeof(JsonDocument))]
TestJsonSerializerContext.cs (1)
31[JsonSerializable(typeof(Dictionary<string, JsonDocument>))] // Used in Content tests
Utilities\AIJsonSchemaTransformCacheTests.cs (1)
64JsonElement schema = JsonDocument.Parse("{}").RootElement;
Utilities\AIJsonUtilitiesTests.cs (27)
152JsonElement expected = JsonDocument.Parse(""" 182JsonElement expected = JsonDocument.Parse(""" 197JsonElement expected = JsonDocument.Parse(""" 246JsonElement expected = JsonDocument.Parse(""" 322JsonElement expected = JsonDocument.Parse($$""" 388JsonElement expected = JsonDocument.Parse($$""" 416using JsonDocument expectedSchema = JsonDocument.Parse(""" 443using JsonDocument doc = JsonDocument.Parse(schema.GetRawText()); 462using JsonDocument doc = JsonDocument.Parse(schema.GetRawText()); 524JsonElement expectedSchema = JsonDocument.Parse(""" 1019JsonElement expectedSchema = JsonDocument.Parse(""" 1278JsonElement schema = JsonDocument.Parse(""" 1289JsonElement expectedSchema = JsonDocument.Parse(""" 1312JsonElement schema = JsonDocument.Parse(""" 1323JsonElement expectedSchema = JsonDocument.Parse(""" 1346JsonElement schema = JsonDocument.Parse(""" 1357JsonElement expectedSchema = JsonDocument.Parse(""" 1381JsonElement schema = JsonDocument.Parse(""" 1393JsonElement expectedSchema = JsonDocument.Parse(""" 1418JsonElement schema = JsonDocument.Parse(""" 1426JsonElement expectedSchema = JsonDocument.Parse(""" 1509JsonElement schema = JsonDocument.Parse("{}").RootElement; 1522JsonElement schema = JsonDocument.Parse(invalidSchema).RootElement; 1534JsonElement schema = JsonDocument.Parse(booleanSchema).RootElement;
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (1)
SerializationChainingTests.cs (1)
37{ "data", JsonDocument.Parse("{\"some\":\"data\"}").RootElement },
Microsoft.Extensions.AI.Evaluation.Safety (10)
ContentSafetyService.cs (10)
55using JsonDocument annotationResponseDocument = JsonDocument.Parse(annotationResponse); 66using JsonDocument metricDetailsDocument = JsonDocument.Parse(metricDetails); 224using JsonDocument document = JsonDocument.Parse(responseContent); 276using JsonDocument document = JsonDocument.Parse(responseContent); 333using JsonDocument document = JsonDocument.Parse(responseContent);
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIConversionTests.cs (2)
536using var jsonDoc = JsonDocument.Parse(parameters);
Microsoft.Extensions.AI.Tests (9)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (2)
38AssertDeepEquals(JsonDocument.Parse(""" 375AssertDeepEquals(JsonDocument.Parse("""
Functions\AIFunctionFactoryTest.cs (6)
135["z"] = JsonDocument.Parse("3"), 136["w"] = JsonDocument.Parse("4").RootElement, 159JsonElement expectedResult = JsonDocument.Parse(jsonStringParam, new() { CommentHandling = JsonCommentHandling.Skip }).RootElement; 179JsonElement expectedResult = JsonDocument.Parse(JsonSerializer.Serialize(invalidJsonParam, JsonContext.Default.String)).RootElement; 1003JsonElement expectedSchema = JsonDocument.Parse(""" 1036JsonElement expectedSchema = JsonDocument.Parse("""
TestJsonSerializerContext.cs (1)
22[JsonSerializable(typeof(Dictionary<string, JsonDocument>))]
Microsoft.Extensions.Configuration.Json (2)
JsonConfigurationFileParser.cs (2)
31using (JsonDocument doc = JsonDocument.Parse(reader.ReadToEnd(), jsonDocumentOptions))
Microsoft.JSInterop.Tests (2)
Infrastructure\DotNetDispatcherTest.cs (2)
131var result = JsonDocument.Parse(resultJson);
Microsoft.ML.Tokenizers.Tests (2)
BpeTests.cs (2)
955using JsonDocument doc = JsonDocument.Parse(json);
Negotiate.Client (2)
Controllers\AuthTestController.cs (2)
284var details = JsonDocument.Parse(body).RootElement; 304var details = JsonDocument.Parse(body).RootElement;
OpenIdConnectSample (2)
Startup.cs (2)
264using (var payload = JsonDocument.Parse(await tokenResponse.Content.ReadAsStringAsync()))
Shared.Tests (5)
JsonSchemaExporter\TestTypes.cs (5)
101yield return new TestData<JsonDocument>(JsonDocument.Parse("""[{ "x" : 42 }]"""), "true"); 102yield return new TestData<JsonElement>(JsonDocument.Parse("""[{ "x" : 42 }]""").RootElement, "true"); 118yield return new TestData<JsonElement?>(JsonDocument.Parse("{}").RootElement, "true"); 1245[JsonSerializable(typeof(JsonDocument))]
SocialSample (9)
Startup.cs (9)
144using (var user = JsonDocument.Parse(await response.Content.ReadAsStringAsync())) 205using (var user = JsonDocument.Parse(await response.Content.ReadAsStringAsync())) 333using (var payload = JsonDocument.Parse(await refreshResponse.Content.ReadAsStringAsync())) 370using (var payload = JsonDocument.Parse(refreshResponse)) 490private async Task PrintRefreshedTokensAsync(HttpResponse response, JsonDocument payload, AuthenticationProperties authProperties)
System.Text.Json (156)
System\Runtime\InteropServices\JsonMarshal.cs (4)
18/// <exception cref="ObjectDisposedException">The underlying <see cref="JsonDocument"/> has been disposed.</exception> 20/// While the method itself does check for disposal of the underlying <see cref="JsonDocument"/>, 35/// <exception cref="ObjectDisposedException">The underlying <see cref="JsonDocument"/> has been disposed.</exception> 38/// While the method itself does check for disposal of the underlying <see cref="JsonDocument"/>,
System\Text\Json\Document\JsonDocument.cs (4)
102/// The parent <see cref="JsonDocument"/> has been disposed. 718JsonDocument newDocument = 1035private static void ValidateNoDuplicateProperties(JsonDocument document) 1043private static void ValidateDuplicatePropertiesCore(JsonDocument document)
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( 789JsonDocument document = new JsonDocument(utf8Json, database, isDisposable: false);
System\Text\Json\Document\JsonDocument.PropertyNameSet.cs (1)
70internal void AddPropertyName(JsonProperty property, JsonDocument document)
System\Text\Json\Document\JsonDocumentOptions.cs (1)
9/// Provides the ability for the user to define custom behavior when parsing JSON to create a <see cref="JsonDocument"/>.
System\Text\Json\Document\JsonElement.ArrayEnumerator.cs (1)
91_curIdx = _target._idx + JsonDocument.DbRow.Size;
System\Text\Json\Document\JsonElement.cs (53)
14/// Represents a specific JSON value within a <see cref="JsonDocument"/>. 19private readonly JsonDocument _parent; 22internal JsonElement(JsonDocument parent, int idx) 45/// The parent <see cref="JsonDocument"/> has been disposed. 60/// The parent <see cref="JsonDocument"/> has been disposed. 80/// The parent <see cref="JsonDocument"/> has been disposed. 97/// The parent <see cref="JsonDocument"/> has been disposed. 131/// The parent <see cref="JsonDocument"/> has been disposed. 171/// The parent <see cref="JsonDocument"/> has been disposed. 210/// The parent <see cref="JsonDocument"/> has been disposed. 250/// The parent <see cref="JsonDocument"/> has been disposed. 285/// The parent <see cref="JsonDocument"/> has been disposed. 321/// The parent <see cref="JsonDocument"/> has been disposed. 342/// The parent <see cref="JsonDocument"/> has been disposed. 373/// The parent <see cref="JsonDocument"/> has been disposed. 398/// The parent <see cref="JsonDocument"/> has been disposed. 421/// The parent <see cref="JsonDocument"/> has been disposed. 449/// The parent <see cref="JsonDocument"/> has been disposed. 470/// The parent <see cref="JsonDocument"/> has been disposed. 498/// The parent <see cref="JsonDocument"/> has been disposed. 521/// The parent <see cref="JsonDocument"/> has been disposed. 548/// The parent <see cref="JsonDocument"/> has been disposed. 568/// The parent <see cref="JsonDocument"/> has been disposed. 595/// The parent <see cref="JsonDocument"/> has been disposed. 619/// The parent <see cref="JsonDocument"/> has been disposed. 647/// The parent <see cref="JsonDocument"/> has been disposed. 667/// The parent <see cref="JsonDocument"/> has been disposed. 694/// The parent <see cref="JsonDocument"/> has been disposed. 718/// The parent <see cref="JsonDocument"/> has been disposed. 746/// The parent <see cref="JsonDocument"/> has been disposed. 769/// The parent <see cref="JsonDocument"/> has been disposed. 796/// The parent <see cref="JsonDocument"/> has been disposed. 820/// The parent <see cref="JsonDocument"/> has been disposed. 857/// The parent <see cref="JsonDocument"/> has been disposed. 888/// The parent <see cref="JsonDocument"/> has been disposed. 924/// The parent <see cref="JsonDocument"/> has been disposed. 955/// The parent <see cref="JsonDocument"/> has been disposed. 982/// The parent <see cref="JsonDocument"/> has been disposed. 1006/// The parent <see cref="JsonDocument"/> has been disposed. 1034/// The parent <see cref="JsonDocument"/> has been disposed. 1057/// The parent <see cref="JsonDocument"/> has been disposed. 1085/// The parent <see cref="JsonDocument"/> has been disposed. 1108/// The parent <see cref="JsonDocument"/> has been disposed. 1136/// The parent <see cref="JsonDocument"/> has been disposed. 1159/// The parent <see cref="JsonDocument"/> has been disposed. 1193/// The parent <see cref="JsonDocument"/> has been disposed. 1543/// The parent <see cref="JsonDocument"/> has been disposed. 1571/// The parent <see cref="JsonDocument"/> has been disposed. 1597/// The parent <see cref="JsonDocument"/> has been disposed. 1618/// For JsonElement built from <see cref="JsonDocument"/>: 1645/// The parent <see cref="JsonDocument"/> has been disposed. 1679/// original <see cref="JsonDocument"/>. 1683/// original <see cref="JsonDocument"/>.
System\Text\Json\Document\JsonElement.ObjectEnumerator.cs (2)
96_curIdx = _target._idx + JsonDocument.DbRow.Size; 104_curIdx += JsonDocument.DbRow.Size;
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\Document\JsonProperty.cs (1)
113/// The parent <see cref="JsonDocument"/> has been disposed.
System\Text\Json\Nodes\JsonNode.Parse.cs (2)
148JsonDocument document = await JsonDocument.ParseAsyncCoreUnrented(utf8Json, documentOptions, cancellationToken).ConfigureAwait(false);
System\Text\Json\Nodes\JsonValue.cs (4)
114JsonElement thisElement = ToJsonElement(this, out JsonDocument? thisDocument); 115JsonElement otherElement = ToJsonElement(otherNode, out JsonDocument? otherDocument); 126static JsonElement ToJsonElement(JsonNode node, out JsonDocument? backingDocument) 144backingDocument = JsonDocument.ParseValue(ref reader);
System\Text\Json\Serialization\Converters\Value\JsonDocumentConverter.cs (4)
9internal sealed class JsonDocumentConverter : JsonConverter<JsonDocument?> 13public override JsonDocument Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => 14JsonDocument.ParseValue(ref reader, options.AllowDuplicateProperties); 16public override void Write(Utf8JsonWriter writer, JsonDocument? value, JsonSerializerOptions options)
System\Text\Json\Serialization\JsonSerializer.Read.Document.cs (15)
13/// Converts the <see cref="JsonDocument"/> representing a single JSON value into a <typeparamref name="TValue"/>. 17/// <param name="document">The <see cref="JsonDocument"/> to convert.</param> 31public static TValue? Deserialize<TValue>(this JsonDocument document, JsonSerializerOptions? options = null) 41/// Converts the <see cref="JsonDocument"/> representing a single JSON value into a <paramref name="returnType"/>. 44/// <param name="document">The <see cref="JsonDocument"/> to convert.</param> 59public static object? Deserialize(this JsonDocument document, Type returnType, JsonSerializerOptions? options = null) 70/// Converts the <see cref="JsonDocument"/> representing a single JSON value into a <typeparamref name="TValue"/>. 74/// <param name="document">The <see cref="JsonDocument"/> to convert.</param> 86public static TValue? Deserialize<TValue>(this JsonDocument document, JsonTypeInfo<TValue> jsonTypeInfo) 97/// Converts the <see cref="JsonDocument"/> representing a single JSON value into an instance specified by the <paramref name="jsonTypeInfo"/>. 99/// <param name="document">The <see cref="JsonDocument"/> to convert.</param> 109public static object? Deserialize(this JsonDocument document, JsonTypeInfo jsonTypeInfo) 120/// Converts the <see cref="JsonDocument"/> representing a single JSON value into a <paramref name="returnType"/>. 123/// <param name="document">The <see cref="JsonDocument"/> to convert.</param> 155public static object? Deserialize(this JsonDocument document, Type returnType, JsonSerializerContext context)
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());
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
164/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonDocument"/> values. 167public static JsonConverter<JsonDocument?> JsonDocumentConverter => s_jsonDocumentConverter ??= new JsonDocumentConverter(); 168private static JsonConverter<JsonDocument?>? s_jsonDocumentConverter;
System\Text\Json\ThrowHelper.cs (1)
756throw new ObjectDisposedException(nameof(JsonDocument));
Templates.Blazor.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
319using var launchSettings = await JsonDocument.ParseAsync(launchSettingsFile);
Templates.Blazor.WebAssembly.Auth.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
319using var launchSettings = await JsonDocument.ParseAsync(launchSettingsFile);
Templates.Blazor.WebAssembly.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
319using var launchSettings = await JsonDocument.ParseAsync(launchSettingsFile);
Templates.Mvc.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
319using var launchSettings = await JsonDocument.ParseAsync(launchSettingsFile);
Templates.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
319using var launchSettings = await JsonDocument.ParseAsync(launchSettingsFile);