Skip to content

Latest commit

 

History

History
93 lines (68 loc) · 2.65 KB

ConvertTo-Toml.md

File metadata and controls

93 lines (68 loc) · 2.65 KB
external help file Module Name online version schema
PSToml.dll-Help.xml
PSToml
2.0.0

ConvertTo-Toml

SYNOPSIS

Converts an object to a TOML-formatted string.

SYNTAX

ConvertTo-Toml [-InputObject] <Object[]> [-Depth <Int32>] [<CommonParameters>]

DESCRIPTION

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.

EXAMPLES

Example 1 - Convert dictionary to TOML

PS C:\> @{Foo = 'Bar'} | ConvertTo-Toml

Converts the input hashtable into a TOML string.

Example 2 - Convert dotnet object to TOML

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.

PARAMETERS

-Depth

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

-InputObject

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Object

Any object piped into this cmdlet will be converted to a TOML string.

OUTPUTS

System.String

This cmdlet returns a string representation of the input object converted to a TOML string.

NOTES

This cmdlet uses the dotnet assembly Tomlyn to perform the TOML conversions.

RELATED LINKS

TOML