Skip to main content

JsonArray

JSON formatted array argument.

Attributes

AttributeTypeDescription
namestring = json arrayThe human-readable 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
) - > list

Converts a JSON-formatted string into a Python list or returns the value if it is already a list. This method parses the input string and validates that the resulting data structure is an array, raising a failure if the JSON is malformed or not a list.

Parameters

NameTypeDescription
valueanyThe raw input value to be converted, typically a JSON-encoded string or an existing list.
paramclick.ParameterThe parameter object that this value is being converted for.
ctxclick.ContextThe current Click execution context for the command.

Returns

TypeDescription
listThe parsed Python list representation of the input JSON array.