external help file | Module Name | online version | schema |
---|---|---|---|
PSToml.dll-Help.xml |
PSToml |
2.0.0 |
Converts an object to a TOML-formatted string.
ConvertTo-Toml [-InputObject] <Object[]> [-Depth <Int32>] [<CommonParameters>]
The ConvertTo-Toml
cmdlet converts any dotnet object to a string in the Tom's Obvious Minimal Language (TOML) format.
The ConvertFrom-Toml cmdlet can be used to convert a TOML string into a dictionary that can be managed in PowerShell.
PS C:\> @{Foo = 'Bar'} | ConvertTo-Toml
Converts the input hashtable into a TOML string.
PS C:\> [PSCustomObject]@{Foo = 'Bar'} | ConvertTo-Toml
Converts the input object into a TOML string.
While this example uses a PSCustomObject
, any dotnet object can be used as the input object.
Specifies how many levels of contained objects are included in the TOML representation.
The value can be any non-negative number with the default being 2
.
ConvertTo-Toml
emits a warning if the number of levels in an input object exceeds this number.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 2
Accept pipeline input: False
Accept wildcard characters: False
The input object to convert to the TOML string. This can be either a dictionary like object or any class object where the properties are used as the TOML keys.
Type: Object[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Any object piped into this cmdlet will be converted to a TOML string.
This cmdlet returns a string representation of the input object converted to a TOML string.
This cmdlet uses the dotnet assembly Tomlyn to perform the TOML conversions.