| external help file | schema-help.xml |
|---|---|
| Module Name | schema |
| online version | https://github.com/SchemaModule/PowerShell/blob/master/docs/ConvertFrom-SchemaArray.md#convertfrom-schemaarray |
| schema | 2.0.0 |
This function takes the schemaArray object and converts it into a PowerShell array that can be nicely output as a JSON string.
ConvertFrom-SchemaArray [-Array] <Object> [[-Depth] <Int32>] [<CommonParameters>]
This function takes the schemaArray object and converts it into a PowerShell array that can be nicely output as a JSON string. This function is useful when you need to output the JSON schema as a JSON object. This would have the effect of creating an empty JSON document based on the schema that was provided.
PS C:\>$Schema=Get-SchemaDocument-Path 'D:\TEMP\test\schema-sample.json'ConvertFrom-SchemaArray-Array $Schema.Find('printers')
brand capability model type
------------------------Take an object defined in a JSON schema and convert it into a custom PowerShell object.
This is a JSON Schema Array as defined by the json-schema.org (see related links below). This array is then converted into a PowerShell object that can be used like any other PowerShell object.
{ "type": "array", "additionalItems": true, "id": "#/properties/contents/items/anyOf/0/properties/printers", "items": { "anyOf": [{ "type": "object", "additionalProperties": true, "id": "#/properties/contents/items/anyOf/0/properties/printers/items/anyOf/0", "properties": "System.Collections.Hashtable", "required": "type capability brand model", "title": "The first anyOf schema", "description": "An explanation about the purpose of this instance.", "default": "", "enum": null }] }, "title": "The printers schema", "description": "An explanation about the purpose of this instance.", "default": [ ] }
Type: System.ObjectParameter Sets: (All)Aliases:
Required: TruePosition: 0Default value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseThe Depth parameter defines the number of levers that are recursed in order to create the object.
Type: System.Int32Parameter Sets: (All)Aliases:
Required: FalsePosition: 1Default value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.