Skip to main content
Returns request variables as a JSON object.

Signature

sqlpage.variables(method TEXT DEFAULT NULL) -> JSON

Parameters

method
TEXT
Optional filter: ‘get’, ‘post’, or ‘set’. When omitted, returns all variables.

Return Value

return
JSON
JSON object containing the requested variables

Description

The variables() function returns all variables from the current request as JSON. This is useful when you don’t know variable names in advance.

Examples

Process All Form Fields

INSERT INTO survey_answers (question_id, answer)
SELECT key, value
FROM json_each(sqlpage.variables('post'));

Debug Request

SELECT 'code' as component;
SELECT 
    'Request Variables' as title,
    'json' as language,
    sqlpage.variables() as contents;

Build docs developers (and LLMs) love