Skip to main content

JSONValuesToLiterals

JSONValuesToLiterals converts a raw JSON object (values) into NamedLiterals using the provided type definitions in variableMap. This is a thin wrapper around jsonValueToLiteralWithFieldName that understands Flyte's LiteralType.

def JSONValuesToLiterals(
ctx: context.Context,
variableMap: *core.VariableMap,
values: *structpb.Struct
) - > []*task.NamedLiteral, error

Converts a raw JSON object (values) into NamedLiterals using the provided type definitions in variableMap. This is a thin wrapper around jsonValueToLiteralWithFieldName that understands Flyte's LiteralType.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, used for logging and cancellation.
variableMap*core.VariableMapA map describing the expected inputs, including their types and names, used to guide the conversion of JSON values to literals.
values*structpb.StructA Struct whose fields are the raw JSON values to be converted into NamedLiterals.

Returns

TypeDescription
[]*task.NamedLiteral, errorA slice of NamedLiteral objects representing the converted JSON values, or an error if the conversion fails.