753 instantiations of JsonObject
aspire (71)
Utils\EnvironmentChecker\VsCodeExtensionCheck.cs (1)
221=> new()
Aspire.Cli.EndToEnd.Tests (6)
Aspire.Cli.Tests (70)
Aspire.Dashboard (3)
Aspire.Dashboard.Tests (9)
Aspire.Hosting (9)
Aspire.Hosting.Azure (17)
Aspire.Hosting.Azure.Kubernetes.Tests (49)
AzureKubernetesInfrastructureTests.cs (49)
254stateManager.SetSection("Azure", new JsonObject
259stateManager.SetSection("Azure:Deployments:aks", new JsonObject
261["Outputs"] = new JsonObject
263["id"] = new JsonObject
270["name"] = new JsonObject
276["Scope"] = new JsonObject
282stateManager.SetSection("HelmChart:aks:podinfo", new JsonObject
416stateManager.SetSection("Azure", new JsonObject
421stateManager.SetSection("Azure:Deployments:aks", new JsonObject
423["Outputs"] = new JsonObject
425["id"] = new JsonObject
430["name"] = new JsonObject
436["Scope"] = new JsonObject
442stateManager.SetSection("Helm:aks", new JsonObject
505stateManager.SetSection("Azure", new JsonObject
510stateManager.SetSection("Azure:Deployments:aks", new JsonObject
512["Outputs"] = new JsonObject
514["id"] = new JsonObject
521stateManager.SetSection("Helm:aks", new JsonObject
585stateManager.SetSection("Azure:Deployments:aks", new JsonObject
589stateManager.SetSection("Helm:aks", new JsonObject
630stateManager.SetSection("Azure:Deployments:aks", new JsonObject
632["Outputs"] = new JsonObject
634["id"] = new JsonObject
678stateManager.SetSection("Sentinel", new JsonObject { ["Value"] = "cleared-by-destroy" });
713stateManager.SetSection("Azure:Deployments:aks", new JsonObject
754stateManager.SetSection("Azure:Deployments:aks", new JsonObject
756["Outputs"] = new JsonObject
758["id"] = new JsonObject
809stateManager.SetSection("Azure:Deployments:aks", new JsonObject
811["Outputs"] = new JsonObject
813["id"] = new JsonObject
820stateManager.SetSection("Helm:aks", new JsonObject
877stateManager.SetSection("Azure:Deployments:aks", new JsonObject
879["Outputs"] = new JsonObject
881["id"] = new JsonObject
949stateManager.SetSection("Azure:Deployments:aks", new JsonObject
951["Outputs"] = new JsonObject
953["id"] = new JsonObject
1018stateManager.SetSection("Azure:Deployments:aks", new JsonObject
1020["Outputs"] = new JsonObject
1022["id"] = new JsonObject
1122deploymentStateManager.SetSection("Azure", new JsonObject
1147deploymentStateManager.SetSection("Azure", new JsonObject
1336deploymentStateManager.SetSection("Azure", new JsonObject
1436deploymentStateManager.SetSection("Azure", new JsonObject
1647deploymentStateManager.SetSection("Azure", new JsonObject
1718deploymentStateManager.SetSection("Azure", new JsonObject
1802var azureState = new JsonObject { ["SubscriptionId"] = subscriptionId };
Aspire.Hosting.Azure.Sandboxes (6)
Aspire.Hosting.Azure.Tests (85)
Aspire.Hosting.Blazor (3)
Aspire.Hosting.CodeGeneration.Java.Tests (1)
Aspire.Hosting.CodeGeneration.TypeScript (10)
Aspire.Hosting.Docker.Tests (1)
Aspire.Hosting.Kubernetes (2)
Aspire.Hosting.Kubernetes.Tests (4)
Aspire.Hosting.Radius (3)
Aspire.Hosting.RemoteHost (8)
Aspire.Hosting.RemoteHost.Tests (230)
CapabilityDispatcherTests.cs (145)
73dispatcher.Invoke("test/capability@1", new JsonObject { ["name"] = "test-value" });
184var args = new JsonObject { ["value"] = "hello" };
196var args = new JsonObject { ["required"] = "test" };
208var args = new JsonObject { ["required"] = "test", ["optional"] = "custom" };
220var args = new JsonObject { ["value"] = "test" };
263var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
290var args = new JsonObject { ["context"] = "not-a-handle" };
302var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = "Aspire.Hosting.RemoteHost.Tests/Aspire.Hosting.RemoteHost.Tests.TestContextType:999" } };
319var getArgs = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
326var invokeArgs = new JsonObject { ["cancellationToken"] = tokenResult };
379var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
398var nestedArgs = new JsonObject { ["context"] = new JsonObject { ["$handle"] = nestedHandleId } };
456var args = new JsonObject
458["context"] = new JsonObject { ["$handle"] = handleId },
477var args = new JsonObject
479["context"] = new JsonObject { ["$handle"] = handleId },
496var args = new JsonObject
498["context"] = new JsonObject { ["$handle"] = handleId },
515var args = new JsonObject
517["context"] = new JsonObject { ["$handle"] = handleId }
548var args = new JsonObject
550["context"] = new JsonObject { ["$handle"] = handleId }
566var args = new JsonObject
568["context"] = new JsonObject { ["$handle"] = handleId },
587var args = new JsonObject
589["context"] = new JsonObject { ["$handle"] = handleId },
607var args = new JsonObject
609["context"] = new JsonObject { ["$handle"] = handleId },
623var args = new JsonObject { ["value"] = "value-task" };
664var args = new JsonObject
687var args = new JsonObject
708var args = new JsonObject
731var args = new JsonObject
830new JsonObject { ["callback"] = "background-callback" });
854new JsonObject { ["callback"] = "background-callback" });
873var args = new JsonObject
901var args = new JsonObject { ["value"] = "test" };
912var args = new JsonObject { ["value"] = "hello" };
924var args = new JsonObject { ["value"] = "test" };
938var args = new JsonObject
953var args = new JsonObject { ["count"] = 3 };
970var args = new JsonObject
986var args = new JsonObject { ["value"] = "hello" };
998var args = new JsonObject { ["value"] = 42 };
1010var args = new JsonObject
1012["value"] = new JsonObject
1028var args = new JsonObject { ["value"] = nameof(TestDispatchEnum.ValueB) };
1040var args = new JsonObject { ["value"] = "/usr/local/lib/redis/modules/redisearch.so" };
1052var args = new JsonObject
1054["value"] = new JsonObject
1078var args = new JsonObject
1080["value"] = new JsonObject { ["$handle"] = handleId }
1093var args = new JsonObject
1111var args = new JsonObject
1113["value"] = new JsonObject
1156var args = new JsonObject
1158["list"] = new JsonObject { ["$handle"] = listHandle },
1178var args = new JsonObject
1180["list"] = new JsonObject { ["$handle"] = listHandle },
1202var removeArgs = new JsonObject
1204["list"] = new JsonObject { ["$handle"] = listHandle },
1213var lengthArgs = new JsonObject
1215["list"] = new JsonObject { ["$handle"] = listHandle }
1234var args = new JsonObject
1236["list"] = new JsonObject { ["$handle"] = listHandle }
1257var clearArgs = new JsonObject
1259["list"] = new JsonObject { ["$handle"] = listHandle }
1264var lengthArgs = new JsonObject
1266["list"] = new JsonObject { ["$handle"] = listHandle }
1302var args = new JsonObject
1304["dict"] = new JsonObject { ["$handle"] = dictHandle },
1324var args = new JsonObject
1326["dict"] = new JsonObject { ["$handle"] = dictHandle },
1346var args = new JsonObject
1348["dict"] = new JsonObject { ["$handle"] = dictHandle },
1370var removeArgs = new JsonObject
1372["dict"] = new JsonObject { ["$handle"] = dictHandle },
1381var countArgs = new JsonObject
1383["dict"] = new JsonObject { ["$handle"] = dictHandle }
1403var hasArgs = new JsonObject
1405["dict"] = new JsonObject { ["$handle"] = dictHandle },
1414var hasArgs2 = new JsonObject
1416["dict"] = new JsonObject { ["$handle"] = dictHandle },
1436var args = new JsonObject
1438["dict"] = new JsonObject { ["$handle"] = dictHandle }
1461var args = new JsonObject
1463["dict"] = new JsonObject { ["$handle"] = dictHandle }
1485var args = new JsonObject
1487["dict"] = new JsonObject { ["$handle"] = dictHandle }
1505var args = new JsonObject
1507["dict"] = new JsonObject { ["$handle"] = dictHandle }
1522var args = new JsonObject
1539var args = new JsonObject
1556var args = new JsonObject
1573var args = new JsonObject
1590var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptOptionalEnum", new JsonObject());
1599var args = new JsonObject
1601["dto"] = new JsonObject
1618var args = new JsonObject
1620["dto"] = new JsonObject
1636var args = new JsonObject
1638["dto"] = new JsonObject
1654var args = new JsonObject();
1676var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
1694var args = new JsonObject
1696["context"] = new JsonObject { ["$handle"] = handleId },
1714var args = new JsonObject
1716["context"] = new JsonObject { ["$handle"] = handleId },
1735var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
1752var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
1767var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
1787var args = new JsonObject
1789["builder"] = new JsonObject { ["$handle"] = targetHandleId },
1790["source"] = new JsonObject { ["$handle"] = sourceHandleId }
1811var args = new JsonObject
1813["builder"] = new JsonObject { ["$handle"] = builderHandleId }
1833var args = new JsonObject
1835["builder"] = new JsonObject { ["$handle"] = builderHandleId }
1855var args = new JsonObject
1857["builder"] = new JsonObject { ["$handle"] = resourceHandleId }
1876var args = new JsonObject
1878["builder"] = new JsonObject { ["$handle"] = builderHandleId }
1902var args = new JsonObject
1904["context"] = new JsonObject { ["$handle"] = targetHandleId },
1905["value"] = new JsonObject { ["$handle"] = valueHandleId }
1930var args = new JsonObject
1932["builder"] = new JsonObject { ["$handle"] = targetHandleId },
1933["source"] = new JsonObject { ["$handle"] = sourceHandleId }
1950var args = new JsonObject
1952["builder"] = new JsonObject { ["$handle"] = builderHandleId }
1977var args = new JsonObject
1979["builder"] = new JsonObject { ["$handle"] = builderHandleId }
2005var args = new JsonObject
2007["builder"] = new JsonObject { ["$handle"] = handles.Register(new TestResourceBuilder<TestResourceWithProperties>(target), "target-type") }
2091var args = new JsonObject
2093["resource"] = new JsonObject { ["$handle"] = handleId },
Aspire.Hosting.Tests (32)
Aspire.Hosting.Yarp (4)
ConfigurationSchemaGenerator (13)
dotnet-user-jwts (7)
Infrastructure.Tests (1)
Microsoft.AspNetCore.OpenApi (23)
Microsoft.Extensions.AI (4)
Microsoft.Extensions.AI.Abstractions (9)
Microsoft.Extensions.AI.Abstractions.Tests (2)
Microsoft.Extensions.AI.Evaluation.Quality (1)
Microsoft.Extensions.AI.Evaluation.Safety (13)
Microsoft.NET.Build.Containers (9)
Microsoft.NET.Build.Tasks (4)
Microsoft.NETCore.Platforms (1)
Microsoft.TemplateEngine.Cli (3)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (1)
MSBuild (8)
NuGet.Protocol (10)
SelectTests (5)
ServiceBus.AppHost (1)
Shared.Tests (1)
Stress.ApiService (1)
System.Text.Json (10)
TestProject.AppHost (3)
1716 references to JsonObject
aspire (204)
Agents\DeprecatedMcpCommandScanner.cs (16)
65var config = JsonNode.Parse(content)?.AsObject();
104private static bool HasDeprecatedMcpCommand(JsonObject config, AgentConfigLocation location)
118private static bool HasDeprecatedMcpServersArgs(JsonObject config, string serversKey)
120if (!config.TryGetPropertyValue(serversKey, out var serversNode) || serversNode is not JsonObject servers)
125if (!servers.TryGetPropertyValue("aspire", out var aspireNode) || aspireNode is not JsonObject aspire)
150private static bool HasDeprecatedMcpCommandArray(JsonObject config, string serversKey)
152if (!config.TryGetPropertyValue(serversKey, out var mcpNode) || mcpNode is not JsonObject mcp)
157if (!mcp.TryGetPropertyValue("aspire", out var aspireNode) || aspireNode is not JsonObject aspire)
182private AgentEnvironmentApplicator CreateUpdateApplicator(AgentConfigLocation location, string configPath, JsonObject config)
198private async Task UpdateConfigAsync(AgentConfigLocation location, string configPath, JsonObject config, CancellationToken cancellationToken)
220private static void UpdateMcpServersArgs(JsonObject config, string serversKey)
223serversNode is JsonObject servers &&
225aspireNode is JsonObject aspire)
234private static void UpdateMcpCommandArray(JsonObject config, string serversKey)
237mcpNode is JsonObject mcp &&
239aspireNode is JsonObject aspire)
Configuration\ConfigurationService.cs (15)
30JsonObject settings;
71var settings = JsonNode.Parse(existingContent, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject();
197var settings = JsonNode.Parse(content, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject();
215private static void SetNestedValue(JsonObject settings, string key, string value)
228var currentObject = settings;
236if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject)
253private static void RemoveConflictingFlattenedKeys(JsonObject settings, string[] keyParts)
266if (settings.ContainsKey(partialKey) && settings[partialKey] is not JsonObject)
278private static bool DeleteNestedValue(JsonObject settings, string key)
289var currentObject = settings;
290var objectPath = new List<(JsonObject obj, string key)>();
298if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject)
340private static void FlattenJsonObject(JsonObject obj, Dictionary<string, string> result, string prefix)
348if (kvp.Value is JsonObject nestedObj)
483if (node is not JsonObject)
Scaffolding\PackageJsonMerger.cs (30)
58JsonObject? existingJson;
59JsonObject? scaffoldJson;
62existingJson = JsonNode.Parse(existingContent, documentOptions: s_jsonDocumentOptions) as JsonObject;
63scaffoldJson = JsonNode.Parse(scaffoldContent, documentOptions: s_jsonDocumentOptions) as JsonObject;
94private static void MergeObjects(JsonObject existing, JsonObject scaffold, ILogger logger, string toolchainCommand)
97var scaffoldScripts = scaffold[ScriptsKey]?.AsObject();
100var existingScripts = EnsureObject(existing, ScriptsKey, logger);
130else if (targetValue is JsonObject targetObj && sourceValue is JsonObject sourceObj)
151internal static void MergeScripts(JsonObject existingScripts, JsonObject scaffoldScripts, string toolchainCommand = "npm")
184private static void AddConvenienceAliases(JsonObject scripts, string toolchainCommand)
220private static void MergeDependencySection(JsonObject existing, JsonObject scaffold, string sectionName, ILogger logger)
222var scaffoldDeps = scaffold[sectionName]?.AsObject();
228var existingDeps = EnsureObject(existing, sectionName, logger);
262private static bool TryMergeExistingDependency(JsonObject existing, string sectionName, string packageName, string desiredVersion)
264if (existing[sectionName] is not JsonObject existingDeps)
291private static void MergeEngines(JsonObject existing, JsonObject scaffold, ILogger logger)
293var scaffoldEngines = scaffold[EnginesKey]?.AsObject();
299var existingEngines = EnsureObject(existing, EnginesKey, logger);
325internal static void DeepMerge(JsonObject target, JsonObject source)
340else if (targetValue is JsonObject targetObj && sourceValue is JsonObject sourceObj)
348private static JsonObject EnsureObject(JsonObject parent, string propertyName, ILogger logger)
350if (parent[propertyName] is JsonObject obj)
Scaffolding\ScaffoldingService.cs (12)
297JsonObject packageJson;
300packageJson = JsonNode.Parse(existingContent, documentOptions: s_scaffoldJsonDocumentOptions) as JsonObject
310var scripts = EnsureJsonObject(packageJson, "scripts");
325internal static IReadOnlyList<string> AddRootTypeScriptAppHostDelegateScripts(JsonObject scripts, TypeScriptAppHostToolchain toolchain, string relativeAppHostDirectory)
336internal static IReadOnlyList<string> AddRootTypeScriptAppHostDelegateScripts(JsonObject scripts, DirectoryInfo appHostDirectory, string relativeAppHostDirectory, IEnvironment environment, ILogger? logger)
342internal static string SerializePackageJson(JsonObject packageJson, string existingContent)
372private static JsonObject EnsureJsonObject(JsonObject parent, string propertyName)
374if (parent[propertyName] is JsonObject obj)
399private static void AddRootTypeScriptAppHostDelegateScript(JsonObject scripts, TypeScriptAppHostToolchain toolchain, string relativeAppHostDirectory, string scriptName, ref List<string>? preservedScriptNames)
692private static JsonObject? ParseJsonC(string content)
696return JsonNode.Parse(content, documentOptions: s_scaffoldJsonDocumentOptions) as JsonObject;
Aspire.Cli.EndToEnd.Tests (29)
Aspire.Cli.Tests (204)
Aspire.Dashboard (13)
Aspire.Dashboard.Tests (6)
Aspire.Hosting (151)
Pipelines\Internal\DeploymentStateManagerBase.cs (19)
39private JsonObject? _state;
58JsonObject state,
60JsonObject? originalSectionData,
66protected virtual JsonNode? GetSectionState(JsonObject? state, string sectionName, bool includeLegacyState) =>
74protected async Task<JsonObject> LoadStateAsync(CancellationToken cancellationToken = default)
98protected virtual Task<JsonObject> LoadStateFromStorageAsync(CancellationToken cancellationToken = default) =>
104protected static async Task<JsonObject> LoadStateFileAsync(string? statePath, CancellationToken cancellationToken)
115protected static JsonObject LoadStateFile(string? statePath)
123private static JsonObject ParseStateFile(string? fileContent)
136if (JsonNode.Parse(fileContent, documentOptions: jsonDocumentOptions) is not JsonObject flattenedState)
145public async Task SaveStateAsync(JsonObject state, CancellationToken cancellationToken = default)
189JsonObject? data = null;
193if (sectionData is JsonObject o)
224protected static JsonNode? TryGetNestedPropertyValue(JsonObject? node, string path)
236if (current is not JsonObject currentObj || !currentObj.TryGetPropertyValue(segment, out var nextNode))
326protected static void SetNestedPropertyValue(JsonObject root, string path, JsonObject? value)
330var current = root;
334if (!current.TryGetPropertyValue(segment, out var nextNode) || nextNode is not JsonObject nextObj)
Pipelines\Internal\FileDeploymentStateManager.cs (68)
33private JsonObject _currentState = [];
34private JsonObject _legacyState = [];
35private JsonObject _legacyStateSnapshot = [];
91internal static async Task<JsonObject> LoadEffectiveStateAsync(
96JsonObject currentState;
119JsonObject legacyState = [];
141var effectiveState = MergeState(MergeState(legacyStateSnapshot, legacyState), currentState);
147internal static JsonObject LoadEffectiveState(string canonicalStatePath, string? legacyStatePath)
149JsonObject currentState;
171JsonObject legacyState = [];
190var effectiveState = MergeState(MergeState(legacyStateSnapshot, legacyState), currentState);
230protected override async Task<JsonObject> LoadStateFromStorageAsync(CancellationToken cancellationToken = default)
271protected override JsonNode? GetSectionState(JsonObject? state, string sectionName, bool includeLegacyState)
289if (mergedSection is not JsonObject mergedObject)
308JsonObject state,
310JsonObject? originalSectionData,
349var sectionData = TryGetNestedPropertyValue(state, sectionName) as JsonObject;
351var latestEffectiveState = MergeState(GetLegacyFallbackState(), _currentState);
353var latestSectionData = NormalizeSectionData(
355var desiredSectionData = ApplyChanges(latestSectionData, originalSectionData, sectionData) as JsonObject;
381private static JsonObject? NormalizeSectionData(JsonNode? sectionData) =>
384JsonObject sectionObject => sectionObject,
431private static JsonObject MergeState(JsonObject legacyState, JsonObject currentState)
433var mergedState = legacyState.DeepClone().AsObject();
437static void MergeInto(JsonObject target, JsonObject source)
441if (sourceValue is JsonObject sourceObject &&
442target[name] is JsonObject targetObject)
454private JsonObject GetLegacyFallbackState() =>
457private static async Task WriteStateAsync(string statePath, JsonObject state, CancellationToken cancellationToken)
459var flattenedSecrets = JsonFlattener.FlattenJsonObject(state);
500JsonObject currentState,
520if (baseline is JsonObject baselineObject && value is JsonObject valueObject)
550if (originalValue is JsonObject originalObject &&
551savedValue is JsonObject savedObject &&
554(latestValue is not JsonObject latestObject || !IsScalarSectionData(latestObject)))
556var result = latestValue?.DeepClone() as JsonObject ?? [];
600if (savedValue is JsonObject savedObject &&
601(originalValue is JsonObject || !originalExists) &&
603(originalValue is not JsonObject originalObject || !IsScalarSectionData(originalObject)) &&
604(latestValue is not JsonObject latestObject || !IsScalarSectionData(latestObject)))
606return (true, ApplyChanges(latestValue, originalValue as JsonObject ?? [], savedObject));
615private static bool IsScalarSectionData(JsonObject value) => value.ContainsKey(string.Empty);
621JsonObject effectiveState,
622JsonObject currentState,
642private static bool NestedPropertyExists(JsonObject root, string path)
645JsonObject current = root;
649nextNode is not JsonObject nextObject)
660private static void SetNestedNodeValue(JsonObject root, string path, JsonNode? value, bool valueExists)
663var current = root;
667if (!current.TryGetPropertyValue(segment, out var nextNode) || nextNode is not JsonObject nextObject)
705var legacyStateSnapshot = migrationState.LegacyStateSnapshot;
734var migrationState = await LoadStateFileAsync(migrationStatePath, cancellationToken).ConfigureAwait(false);
746private static MigrationState ParseMigrationState(JsonObject migrationState)
749var legacyStateSnapshot = migrationState[LegacyStateProperty] switch
752JsonObject legacyState => legacyState,
761var currentState = migrationState[CurrentStateProperty] switch
797JsonObject currentState,
798JsonObject legacyStateSnapshot,
803var migrationState = new JsonObject
817JsonObject LegacyStateSnapshot,
819JsonObject? CurrentState);
Aspire.Hosting.Azure (65)
AzureProvisioningController.cs (16)
2430var json = await CreateCommandResultJsonAsync(commandName, resourceName: null, cancellationToken).ConfigureAwait(false);
2450var json = await CreateResourceCommandResultJsonAsync(DeleteAzureResourceCommandName, model, resourceName, cancellationToken).ConfigureAwait(false);
2462private async Task<JsonObject> CreateResourceCommandResultJsonAsync(string commandName, DistributedApplicationModel model, string resourceName, CancellationToken cancellationToken)
2464var json = await CreateCommandResultJsonAsync(commandName, resourceName, cancellationToken).ConfigureAwait(false);
2484var json = await CreateCommandResultJsonAsync(GetAzureResourceCommandName, resourceName, cancellationToken).ConfigureAwait(false);
2496var deployment = await CreateCachedDeploymentStateInfoAsync(bicepResource, context, cancellationToken).ConfigureAwait(false);
2507private async Task<JsonObject> CreateCachedDeploymentStateInfoAsync(AzureBicepResource resource, AzureContextState context, CancellationToken cancellationToken)
2518var json = new JsonObject
2550private async Task<JsonObject> CreateLiveResourceInfoAsync(string? resourceId, AzureContextState context, CancellationToken cancellationToken)
2554var json = new JsonObject
2658if (outputs is not JsonObject outputsObject ||
2660outputNode is not JsonObject outputObject ||
2669private async Task<JsonObject> CreateCommandResultJsonAsync(string commandName, string? resourceName, CancellationToken cancellationToken)
2675var json = new JsonObject
2701private static CommandResultData CreateJsonResultData(JsonObject json, bool displayImmediately = false) =>
2721var json = new JsonObject
Provisioning\BicepUtilities.cs (9)
40public static async Task SetParametersAsync(JsonObject parameters, AzureBicepResource resource, bool skipKnownValues = false, CancellationToken cancellationToken = default)
76public static async Task SetScopeAsync(JsonObject scope, AzureBicepResource resource, CancellationToken cancellationToken = default)
103public static string GetChecksum(AzureBicepResource resource, JsonObject parameters, JsonObject? scope)
134var parameters = JsonNode.Parse(jsonString)?.AsObject();
135var scope = section[DeploymentStateScopeKey] is string scopeString
178var parameters = JsonNode.Parse(jsonString)?.AsObject();
179var scope = section.Data[DeploymentStateScopeKey]?.GetValue<string>() is { Length: > 0 } scopeString
219private static async Task SetScopeValueAsync(JsonObject scope, string propertyName, object? value, CancellationToken cancellationToken)
Provisioning\Provisioners\BicepProvisioner.cs (12)
353JsonObject? outputs,
357if (!TryGetDeploymentStateJsonObject(stateSection, BicepUtilities.DeploymentStateParametersKey, resource.Name, out var parameters) ||
371var scope = TryGetDeploymentStateJsonObject(stateSection, BicepUtilities.DeploymentStateScopeKey, resource.Name, out var cachedScope)
473[NotNullWhen(true)] out JsonObject? value)
568var parameters = new JsonObject();
571var scope = new JsonObject();
791var outputObj = outputs?.ToObjectFromJson<JsonObject>();
1319JsonObject parameters,
1320JsonObject? outputObj,
1321JsonObject? scope,
Aspire.Hosting.Azure.Kubernetes (4)
Aspire.Hosting.Azure.Kubernetes.Tests (4)
Aspire.Hosting.Azure.Sandboxes (18)
Aspire.Hosting.Azure.Tests (101)
Aspire.Hosting.Blazor (2)
Aspire.Hosting.Browsers.Tests (1)
Aspire.Hosting.CodeGeneration.Go (3)
Aspire.Hosting.CodeGeneration.Java (3)
Aspire.Hosting.CodeGeneration.Python (3)
Aspire.Hosting.CodeGeneration.TypeScript (21)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (19)
Aspire.Hosting.Docker.Tests (3)
Aspire.Hosting.Kubernetes (2)
Aspire.Hosting.Kubernetes.Tests (3)
Aspire.Hosting.Radius (2)
Aspire.Hosting.RemoteHost (54)
Ats\AtsCallbackProxyFactory.cs (16)
128var jsonObjectType = typeof(JsonObject);
188argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
203argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
218argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
233argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
238private void InvokeSyncVoid(string callbackId, JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
244private void InvokeSyncVoidWithDtoWriteback(string callbackId, JsonObject? args, object?[] originalArgs, Type[] argTypes, CancellationToken cancellationToken, int ctParamIndex)
251private T? InvokeSyncResult<T>(string callbackId, JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
258private async Task InvokeAsyncVoid(string callbackId, JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
264private async Task InvokeAsyncVoidWithDtoWriteback(string callbackId, JsonObject? args, object?[] originalArgs, Type[] argTypes, CancellationToken cancellationToken, int ctParamIndex)
271private async Task<T?> InvokeAsyncResult<T>(string callbackId, JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
294private void AddCancellationTokenToArgs(ref JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
327argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
346argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
377if (result is not JsonObject returnedArgs)
405if (returnedArgs[key] is JsonObject modifiedDto)
Ats\CapabilityDispatcher.cs (15)
22JsonObject? args,
538public async Task<JsonNode?> InvokeAsync(string capabilityId, JsonObject? args)
623public JsonNode? Invoke(string capabilityId, JsonObject? args)
756JsonObject? args,
799JsonObject? args,
957JsonObject obj when obj.ContainsKey("$handle") => "handle",
958JsonObject => "object",
966JsonObject? args,
1028public static string GetRequiredString(this JsonObject args, string name, string capabilityId)
1042public static string? GetOptionalString(this JsonObject args, string name)
1054public static int? GetOptionalInt(this JsonObject args, string name)
1067this JsonObject args,
1097public static T? GetDto<T>(this JsonObject args, string name) where T : class
1099if (args.TryGetPropertyValue(name, out var node) && node is JsonObject obj)
1109public static JsonObject CreateHandleResult(this HandleRegistry handles, object obj, string typeId)
Aspire.Hosting.RemoteHost.Tests (186)
Aspire.Hosting.Tests (31)
Aspire.Hosting.TestUtilities (1)
Aspire.Hosting.Yarp (5)
ConfigurationSchemaGenerator (23)
ConfigSchemaEmitter.cs (23)
44var root = new JsonObject();
51private void GenerateLogCategories(JsonObject parent)
59var propertiesNode = new JsonObject(s_ignoreCaseNodeOptions);
62var categoryNode = new JsonObject();
76private void GenerateGraph(JsonObject rootNode)
101private bool GeneratePathSegment(JsonObject currentNode, TypeSpec type, Queue<string> pathSegments)
123if (currentNode[propertiesName] is not JsonObject propertiesNode)
132if (propertiesNode[pathSegment] is not JsonObject pathSegmentNode)
182private bool GenerateType(JsonObject currentNode, TypeSpec type)
226private bool GenerateObject(JsonObject currentNode, ObjectSpec objectSpec)
244if (currentNode["properties"] is not JsonObject propertiesNode)
275private bool GenerateProperty(JsonObject currentNode, PropertySpec property, IPropertySymbol? propertySymbol)
286var propertyNode = new JsonObject();
306private bool GenerateCollection(JsonObject currentNode, CollectionSpec collection, string typeName, string containerName)
319var containerNode = new JsonObject();
334private static void RestoreBackup(JsonNode? backupNode, string name, JsonObject parentNode)
434private static void GenerateDescriptionFromDocComment(JsonObject propertyNode, string docComment)
490private void GenerateDescriptionForType(JsonObject currentNode, TypeSpec type)
587private void GenerateParsableFromString(JsonObject propertyNode, ParsableFromStringSpec parsable)
678private bool IsExcluded(JsonObject currentNode, PropertySpec property)
718private static void ReplaceNodeWithKeyCasingChange(JsonObject jsonObject, string key, JsonNode value)
739case JsonObject obj:
743obj.Parent is JsonObject && obj.GetPropertyName() == "properties" ?
dotnet-user-jwts (19)
Infrastructure.Tests (29)
Pipelines\NixCliPackageTests.cs (20)
27var manifest = await ReadJsonObjectAsync("eng/nix/versions.json");
33var systems = GetRequiredObject(manifest, "systems");
40var entry = GetRequiredObject(systems, system);
59var manifest = await ReadJsonObjectAsync("eng/nix/versions.json");
103var manifest = await ReadJsonObjectAsync(outputPath);
104var systems = GetRequiredObject(manifest, "systems");
109var entry = GetRequiredObject(systems, system);
165var manifest = await ReadJsonObjectAsync(outputPath);
166var systems = GetRequiredObject(manifest, "systems");
170var entry = GetRequiredObject(systems, system);
200var flakeLock = await ReadJsonObjectAsync("flake.lock");
201var nodes = GetRequiredObject(flakeLock, "nodes");
202var nixpkgs = GetRequiredObject(nodes, "nixpkgs");
203var locked = GetRequiredObject(nixpkgs, "locked");
204var original = GetRequiredObject(nixpkgs, "original");
213private static async Task<JsonObject> ReadJsonObjectAsync(string relativePath)
256private static JsonObject GetRequiredObject(JsonObject obj, string propertyName)
259return Assert.IsType<JsonObject>(value);
262private static string GetRequiredString(JsonObject obj, string propertyName)
Microsoft.AspNetCore.JsonPatch.SystemTextJson (13)
Microsoft.AspNetCore.OpenApi (10)
Microsoft.Extensions.AI (4)
Microsoft.Extensions.AI.Abstractions (29)
Microsoft.Extensions.AI.Abstractions.Tests (8)
Microsoft.Extensions.AI.Evaluation.Safety (9)
Microsoft.Extensions.AI.OpenAI (2)
Microsoft.ML.AutoML (1)
Microsoft.ML.AutoML.SourceGenerator (1)
Microsoft.ML.GenAI.Mistral (2)
Microsoft.NET.Build.Containers (16)
Microsoft.NET.Build.Tasks (12)
Microsoft.NETCore.Platforms (1)
Microsoft.TemplateEngine.Cli (23)
Microsoft.TemplateEngine.Edge (59)
parent\Shared\JExtensions.cs (33)
44if (token is not JsonObject obj)
156if (token is not JsonObject obj)
197internal static IReadOnlyList<string> ToStringReadOnlyList(this JsonObject jObject, string propertyName, IReadOnlyList<string>? defaultValue = null)
210if (token is not JsonObject obj)
222return element is not JsonObject jObj ? [] : GetObjectProperties(jObj);
228/// Enumerates the properties of a <see cref="JsonObject"/>, handling duplicate keys gracefully.
231/// <see cref="JsonObject"/> lazily initializes its internal dictionary when first accessed.
236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj)
251/// Enumerates the properties of a <see cref="JsonObject"/> by re-parsing its JSON text via
255/// <see cref="JsonObject.WriteTo"/> falls back to the underlying <see cref="System.Text.Json.JsonElement"/>
257/// safe to call even after a failed <see cref="JsonObject"/> initialization.
260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj)
285if (token is not JsonObject obj || key == null)
439internal static JsonObject ReadJObjectFromIFile(this IFile file)
444return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
448internal static JsonObject ReadObject(this IPhysicalFileSystem fileSystem, string path)
453return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
501/// Tries to get a property value from a <see cref="JsonObject"/> using case-insensitive key matching.
503internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result)
513internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
546private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
574internal static JsonObject ParseJsonObject(string json)
576return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
596internal static JsonObject FromObject(object obj)
599return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
604/// Creates a deep clone of a <see cref="JsonObject"/> by round-tripping through JSON text.
606internal static JsonObject DeepCloneObject(this JsonObject source)
608return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions)
619internal static void Merge(this JsonObject target, JsonObject source)
623if (property.Value is JsonObject sourceObj
625&& targetNode is JsonObject targetObj)
Settings\TemplateCache.cs (6)
61(string, JsonObject?)? hostFile = GetBestHostConfigMatch(chosenTemplate.Template, environmentSettings, chosenTemplate.MountPoint);
74public TemplateCache(JsonObject? contentJObject)
95if (contentJObject.TryGetValueCaseInsensitive(nameof(MountPointsInfo), out JsonNode? mountPointInfoToken) && mountPointInfoToken is JsonObject mountPointInfoObj)
114if (entry is JsonObject entryObj)
201private (string, JsonObject?)? GetBestHostConfigMatch(IScanTemplateInfo newTemplate, IEngineEnvironmentSettings settings, IMountPoint mountPoint)
218private JsonObject? ReadHostFile(IScanTemplateInfo template, string path, IEngineEnvironmentSettings settings, IMountPoint mountPoint)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (103)
parent\Shared\JExtensions.cs (33)
44if (token is not JsonObject obj)
156if (token is not JsonObject obj)
197internal static IReadOnlyList<string> ToStringReadOnlyList(this JsonObject jObject, string propertyName, IReadOnlyList<string>? defaultValue = null)
210if (token is not JsonObject obj)
222return element is not JsonObject jObj ? [] : GetObjectProperties(jObj);
228/// Enumerates the properties of a <see cref="JsonObject"/>, handling duplicate keys gracefully.
231/// <see cref="JsonObject"/> lazily initializes its internal dictionary when first accessed.
236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj)
251/// Enumerates the properties of a <see cref="JsonObject"/> by re-parsing its JSON text via
255/// <see cref="JsonObject.WriteTo"/> falls back to the underlying <see cref="System.Text.Json.JsonElement"/>
257/// safe to call even after a failed <see cref="JsonObject"/> initialization.
260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj)
285if (token is not JsonObject obj || key == null)
439internal static JsonObject ReadJObjectFromIFile(this IFile file)
444return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
448internal static JsonObject ReadObject(this IPhysicalFileSystem fileSystem, string path)
453return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
501/// Tries to get a property value from a <see cref="JsonObject"/> using case-insensitive key matching.
503internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result)
513internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
546private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
574internal static JsonObject ParseJsonObject(string json)
576return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
596internal static JsonObject FromObject(object obj)
599return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
604/// Creates a deep clone of a <see cref="JsonObject"/> by round-tripping through JSON text.
606internal static JsonObject DeepCloneObject(this JsonObject source)
608return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions)
619internal static void Merge(this JsonObject target, JsonObject source)
623if (property.Value is JsonObject sourceObj
625&& targetNode is JsonObject targetObj)
Microsoft.TemplateEngine.Utils (33)
parent\Shared\JExtensions.cs (33)
44if (token is not JsonObject obj)
156if (token is not JsonObject obj)
197internal static IReadOnlyList<string> ToStringReadOnlyList(this JsonObject jObject, string propertyName, IReadOnlyList<string>? defaultValue = null)
210if (token is not JsonObject obj)
222return element is not JsonObject jObj ? [] : GetObjectProperties(jObj);
228/// Enumerates the properties of a <see cref="JsonObject"/>, handling duplicate keys gracefully.
231/// <see cref="JsonObject"/> lazily initializes its internal dictionary when first accessed.
236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj)
251/// Enumerates the properties of a <see cref="JsonObject"/> by re-parsing its JSON text via
255/// <see cref="JsonObject.WriteTo"/> falls back to the underlying <see cref="System.Text.Json.JsonElement"/>
257/// safe to call even after a failed <see cref="JsonObject"/> initialization.
260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj)
285if (token is not JsonObject obj || key == null)
439internal static JsonObject ReadJObjectFromIFile(this IFile file)
444return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
448internal static JsonObject ReadObject(this IPhysicalFileSystem fileSystem, string path)
453return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
501/// Tries to get a property value from a <see cref="JsonObject"/> using case-insensitive key matching.
503internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result)
513internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
546private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
574internal static JsonObject ParseJsonObject(string json)
576return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
596internal static JsonObject FromObject(object obj)
599return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
604/// Creates a deep clone of a <see cref="JsonObject"/> by round-tripping through JSON text.
606internal static JsonObject DeepCloneObject(this JsonObject source)
608return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions)
619internal static void Merge(this JsonObject target, JsonObject source)
623if (property.Value is JsonObject sourceObj
625&& targetNode is JsonObject targetObj)
Microsoft.TemplateSearch.Common (71)
parent\Shared\JExtensions.cs (33)
44if (token is not JsonObject obj)
156if (token is not JsonObject obj)
197internal static IReadOnlyList<string> ToStringReadOnlyList(this JsonObject jObject, string propertyName, IReadOnlyList<string>? defaultValue = null)
210if (token is not JsonObject obj)
222return element is not JsonObject jObj ? [] : GetObjectProperties(jObj);
228/// Enumerates the properties of a <see cref="JsonObject"/>, handling duplicate keys gracefully.
231/// <see cref="JsonObject"/> lazily initializes its internal dictionary when first accessed.
236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj)
251/// Enumerates the properties of a <see cref="JsonObject"/> by re-parsing its JSON text via
255/// <see cref="JsonObject.WriteTo"/> falls back to the underlying <see cref="System.Text.Json.JsonElement"/>
257/// safe to call even after a failed <see cref="JsonObject"/> initialization.
260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj)
285if (token is not JsonObject obj || key == null)
439internal static JsonObject ReadJObjectFromIFile(this IFile file)
444return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
448internal static JsonObject ReadObject(this IPhysicalFileSystem fileSystem, string path)
453return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
501/// Tries to get a property value from a <see cref="JsonObject"/> using case-insensitive key matching.
503internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result)
513internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
546private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
574internal static JsonObject ParseJsonObject(string json)
576return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
596internal static JsonObject FromObject(object obj)
599return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
604/// Creates a deep clone of a <see cref="JsonObject"/> by round-tripping through JSON text.
606internal static JsonObject DeepCloneObject(this JsonObject source)
608return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions)
619internal static void Merge(this JsonObject target, JsonObject source)
623if (property.Value is JsonObject sourceObj
625&& targetNode is JsonObject targetObj)
TemplateDiscoveryMetadata\LegacySearchCacheReader.cs (12)
61JsonObject cacheObject = JExtensions.ParseJsonObject(cacheText);
66internal static bool TryReadDiscoveryMetadata(JsonObject cacheObject, ILogger logger, IReadOnlyDictionary<string, Func<object, object>>? additionalDataReaders, out TemplateDiscoveryMetadata? discoveryMetadata)
81private static bool TryReadVersion(ILogger logger, JsonObject cacheObject, out string? version)
97JsonObject cacheObject,
112if (entry is JsonObject entryObj)
143private static bool TryReadPackToTemplateMap(ILogger logger, JsonObject cacheObject, out IReadOnlyDictionary<string, PackToTemplateEntry>? packToTemplateMap)
149if (packToTemplateMapToken is not JsonObject packToTemplateMapObject)
163JsonObject entryValue = (JsonObject)packEntry.Value;
208private static bool TryReadAdditionalData(ILogger logger, JsonObject cacheObject, IReadOnlyDictionary<string, Func<object, object>>? additionalDataReaders, out IReadOnlyDictionary<string, object>? additionalData)
218if (additionalDataToken is not JsonObject additionalDataObject)
233if (dataNode is not JsonObject dataObject)
MSBuild (5)
NuGet.Protocol (11)
sdk-tasks (6)
SelectTests (2)
Shared.Tests (2)
System.Text.Json (81)
TestProject.AppHost (3)