Skip to content

Commit 8a70393

Browse files
committed
changed json example
1 parent b45841c commit 8a70393

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

articles/azure-resource-manager/templates/template-functions-object.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Determines if an array, object, or string is empty.
106106

107107
| Parameter | Required | Type | Description |
108108
|:--- |:--- |:--- |:--- |
109-
| itemToTest |Yes |array, object, or string |The value to check if it is empty. |
109+
| itemToTest |Yes |array, object, or string |The value to check if it's empty. |
110110

111111
### Return value
112112

@@ -249,13 +249,21 @@ If you need to include a parameter value or variable in the JSON object, use the
249249

250250
### Example
251251

252-
The following [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/functions/json.json) shows how to use the json function with arrays and objects:
252+
The following [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/functions/json.json) shows how to use the json function. Notice that you can either pass in a string that represents the object or use **null** when no value is needed.
253253

254254
```json
255255
{
256256
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
257257
"contentVersion": "1.0.0.0",
258258
"parameters": {
259+
"jsonObject1": {
260+
"type": "string",
261+
"defaultValue": "null"
262+
},
263+
"jsonObject2": {
264+
"type": "string",
265+
"defaultValue": "{\"a\": \"b\"}"
266+
},
259267
"testValue": {
260268
"type": "string",
261269
"defaultValue": "demo value"
@@ -264,13 +272,13 @@ The following [example template](https://github.com/Azure/azure-docs-json-sample
264272
"resources": [
265273
],
266274
"outputs": {
267-
"jsonOutput": {
268-
"type": "object",
269-
"value": "[json('{\"a\": \"b\"}')]"
270-
},
271-
"nullOutput": {
275+
"jsonOutput1": {
272276
"type": "bool",
273-
"value": "[empty(json('null'))]"
277+
"value": "[empty(json(parameters('jsonObject1')))]"
278+
},
279+
"jsonOutput2": {
280+
"type": "object",
281+
"value": "[json(parameters('jsonObject2'))]"
274282
},
275283
"paramOutput": {
276284
"type": "object",
@@ -284,8 +292,8 @@ The output from the preceding example with the default values is:
284292

285293
| Name | Type | Value |
286294
| ---- | ---- | ----- |
287-
| jsonOutput | Object | {"a": "b"} |
288-
| nullOutput | Boolean | True |
295+
| jsonOutput1 | Boolean | True |
296+
| jsonOutput2 | Object | {"a": "b"} |
289297
| paramOutput | Object | {"a": "demo value"}
290298

291299
## length

articles/azure-resource-manager/templates/template-functions-resource.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,7 @@ The following [example template](https://github.com/Azure/azure-docs-json-sample
931931

932932
## subscriptionResourceId
933933

934-
```json
935-
subscriptionResourceId([subscriptionId], resourceType, resourceName1, [resourceName2], ...)
936-
```
934+
`subscriptionResourceId([subscriptionId], resourceType, resourceName1, [resourceName2], ...)`
937935

938936
Returns the unique identifier for a resource deployed at the subscription level.
939937

0 commit comments

Comments
 (0)