JsonObject
JSON formatted object argument.
Attributes
| Attribute | Type | Description |
|---|---|---|
| name | string = json object | The display name of the parameter type used for error messages and help text. |
Methods
convert()
@classmethod
def convert(
value: any,
param: click.Parameter,
ctx: click.Context
) - > dict
Parses a JSON-formatted string into a Python dictionary or returns the value directly if it is already a dictionary. This method ensures the input represents a valid JSON object and raises a failure if the parsing fails or if the resulting data is not a dictionary.
Parameters
| Name | Type | Description |
|---|---|---|
| value | any | The raw input value to be converted, typically a JSON-encoded string or an existing dictionary. |
| param | click.Parameter | The parameter object that this value is being associated with during argument parsing. |
| ctx | click.Context | The current execution context for the command line interface. |
Returns
| Type | Description |
|---|---|
dict | The parsed JSON object as a Python dictionary. |