| external help file | schema-help.xml |
|---|---|
| Module Name | schema |
| online version | https://github.com/SchemaModule/PowerShell/blob/master/docs/ConvertFrom-SchemaObject.md#convertfrom-schemaobject |
| schema | 2.0.0 |
This function takes the schemaObject object and converts it into a PowerShell object that can be nicely output as a JSON string.
ConvertFrom-SchemaObject [-Object] <Object> [[-Depth] <Int32>] [<CommonParameters>]
This function takes the schemaObject object and converts it into a PowerShell object 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-SchemaObject-Object $Schema$schema : http://json-schema.org/draft-07/schema#$id : http://example.com/example.json
width :
depth :
closet : False
room :
contents : {System.Object}
exterioraccess : FalseTake an object defined in a JSON schema and convert it into a custom PowerShell object.
The 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 is a JSON Schema object as defined by the json-schema.org (see related links below). This object is then converted into a PowerShell object that can be used like any other PowerShell object.
{ "type": "object", "schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": true, "definitions": null, "id": "http://example.com/example.json", "properties": { "width": "schemaString", "depth": "schemaString", "closet": "schemaBoolean", "room": "schemaString", "contents": "schemaArray", "exterioraccess": "schemaBoolean" }, "required": [ "room", "width", "depth", "closet", "exterioraccess", "contents" ], "title": "The root schema", "description": "The root schema comprises the entire JSON document.", "default": {
} }
Type: System.ObjectParameter Sets: (All)Aliases:
Required: TruePosition: 0Default 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.