Skip to content

Commit 3250a6b

Browse files
authored
Update ConvertTo-JsonForPSWS.md
1 parent a37de35 commit 3250a6b

File tree

1 file changed

+94
-10
lines changed

1 file changed

+94
-10
lines changed

skype/skype-ps/skype/ConvertTo-JsonForPSWS.md

Lines changed: 94 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# ConvertTo-JsonForPSWS
99

1010
## SYNOPSIS
11-
ConvertTo-JsonForPSWS \[-InputObject\] \<Object\> \[-Depth \<int\>\] \[-Compress\] \[\<CommonParameters\>\]
11+
Converts an object to a JSON-formatted string for PowerShell Web Services.
1212

1313
## SYNTAX
1414

@@ -17,21 +17,98 @@ ConvertTo-JsonForPSWS [[-InputObject] <Object>] [-Compress] [-Depth <Object>] [-
1717
```
1818

1919
## DESCRIPTION
20-
{{Fill in the Description}}
20+
The `ConvertTo-JsonForPSWS` cmdlet converts any object to a string in JavaScript Object Notation (JSON) format for PowerShell Web Services. The properties are converted to field names, the field values are converted to property values, and the methods are removed.
21+
22+
You can then use the `ConvertTo-JsonForPSWS` cmdlet to convert a JSON-formatted string to a JSON object, which is easily managed in Windows PowerShell.
23+
24+
Many web sites use JSON instead of XML to serialize data for communication between servers and web-based apps.
2125

2226
## EXAMPLES
2327

2428
### -------------------------- Example 1 --------------------------
2529
```
26-
PS C:\> {{ Add example code here }}
30+
PS C:\> (Get-UICulture).Calendar | ConvertTo-JsonForPSWS
31+
{
32+
"MinSupportedDateTime": "\/Date(-62135568000000)\/",
33+
"MaxSupportedDateTime": "\/Date(253402300799999)\/",
34+
"AlgorithmType": "SolarCalendar",
35+
"CalendarType": "Localized",
36+
"Eras": [
37+
1
38+
],
39+
"TwoDigitYearMax": 2029,
40+
"IsReadOnly": false
41+
}
42+
```
43+
44+
This command uses the `ConvertTo-JsonForPSWS` cmdlet to convert a GregorianCalendar object to a JSON-formatted string for PowerShell Web Services.
45+
46+
### -------------------------- Example 2 --------------------------
47+
```
48+
PS C:\> @{Account="User01";Domain="Domain01";Admin="True"} | ConvertTo-JsonForPSWS -Compress
49+
{"Admin":"True","Account":"User01","Domain":"Domain01"}
50+
```
51+
52+
This command shows the effect of using the Compress parameter of `ConvertTo-JsonForPSWS`. The compression affects only the appearance of the string, not its validity.
53+
54+
### -------------------------- Example 3 --------------------------
55+
```
56+
PS C:\> Get-Date | Select-Object -Property * | ConvertTo-JsonForPSWS
57+
{
58+
"DisplayHint": {
59+
"value": 2,
60+
"Value": "DateTime"
61+
},
62+
"DateTime": "domingo, 27 de mayo de 2018 19:01:15",
63+
"Date": "\/Date(1527390000000)\/",
64+
"Day": 27,
65+
"DayOfWeek": {
66+
"value": 0,
67+
"Value": "Sunday"
68+
},
69+
"DayOfYear": 147,
70+
"Hour": 19,
71+
"Kind": {
72+
"value": 2,
73+
"Value": "Local"
74+
},
75+
"Millisecond": 225,
76+
"Minute": 1,
77+
"Month": 5,
78+
"Second": 15,
79+
"Ticks": 636630444752251610,
80+
"TimeOfDay": {
81+
"Hours": 19,
82+
"Minutes": 1,
83+
"Seconds": 15,
84+
"Ticks": 684752251610,
85+
"Days": 0,
86+
"Milliseconds": 225,
87+
"TotalDays": 0.79253732825231482,
88+
"TotalHours": 19.020895878055555,
89+
"TotalMilliseconds": 68475225.161,
90+
"TotalMinutes": 1141.2537526833335,
91+
"TotalSeconds": 68475.225161
92+
},
93+
"Year": 2018
94+
}
2795
```
2896

29-
{{ Add example description here }}
97+
This command shows how to use the `ConvertTo-JsonForPSWS` cmdlet to convert an object to a JSON string for PowerShell Web Services.
98+
99+
It uses the `ConvertTo-JsonForPSWS` cmdlet to convert a System.DateTime object from the Get-Date cmdlet to a JSON-formatted string for PowerShell Web Services. The command uses the Select-Object cmdlet to get all () of the properties of the **DateTime* object. The output shows the JSON string that `ConvertTo-JsonForPSWS` returned.
100+
101+
### -------------------------- Example 2 --------------------------
102+
```
103+
PS C:\> $JsonSecurityHelp = Get-Content $Pshome\Modules\Microsoft.PowerShell.Security\en-US\Microsoft.PowerShell.Security.dll-Help.xml | ConvertTo-JsonForPSWS
104+
```
105+
106+
This command uses the `ConvertTo-JsonForPSWS` cmdlet to convert a Windows PowerShell Help file from XML format to JSON format for PowerShell Web Services. You can use a command like this to use the Help topic content in a web service application.
30107

31108
## PARAMETERS
32109

33110
### -Compress
34-
{{Fill Compress Description}}
111+
Omits white space and indented formatting in the output string.
35112

36113
```yaml
37114
Type: SwitchParameter
@@ -47,7 +124,7 @@ Accept wildcard characters: False
47124
```
48125
49126
### -Depth
50-
{{Fill Depth Description}}
127+
Specifies how many levels of contained objects are included in the JSON representation. The default value is 2.
51128
52129
```yaml
53130
Type: Object
@@ -63,7 +140,9 @@ Accept wildcard characters: False
63140
```
64141
65142
### -InputObject
66-
{{Fill InputObject Description}}
143+
Specifies the objects to convert to JSON format. Enter a variable that contains the objects, or type a command or expression that gets the objects. You can also pipe an object to `ConvertTo-JsonForPSWS`.
144+
145+
The InputObject parameter is required, but its value can be null ($Null) or an empty string. When the input object is $Null, `ConvertTo-JsonForPSWS` does not generate any output. When the input object is an empty string, `ConvertTo-JsonForPSWS` returns an empty string.
67146

68147
```yaml
69148
Type: Object
@@ -79,7 +158,11 @@ Accept wildcard characters: False
79158
```
80159

81160
### -AsJob
82-
{{Fill AsJob Description}}
161+
Indicates that this cmdlet runs as a background job.
162+
163+
When you specify the AsJob parameter, the command immediately returns an object that represents the background job. You can continue to work in the session while the job finishes. The job is created on the local computer and the results from the Skype for Business Online session are automatically returned to the local computer. To get the job results, use the Receive-Job cmdlet.
164+
165+
For more information about Windows PowerShell background jobs, see [about_Jobs](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_jobs?view=powershell-6) and [about_Remote_Jobs](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_remote_jobs?view=powershell-6).
83166

84167
```yaml
85168
Type: SwitchParameter
@@ -100,14 +183,15 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
100183
## INPUTS
101184

102185
### System.Object
186+
You can pipe any object to ConvertTo-JsonForPSWS.
103187

104188
## OUTPUTS
105189

106-
### System.Object
190+
### System.String
107191

108192
## NOTES
109193

110194
## RELATED LINKS
111195

112-
[http://go.microsoft.com/fwlink/?LinkID=217032](http://go.microsoft.com/fwlink/?LinkID=217032)
196+
[ConvertTo-Json](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertto-json?view=powershell-6)
113197

0 commit comments

Comments
 (0)