4. Query string mapping
In a URL query string, keys starting with @ are control parameters, and every other key is a condition on one field: the key is the field path and the value is the condition.
4.1 Decoding
Section titled “4.1 Decoding”QS_DECODE MUST
Keys and values MUST be interpreted after decoding the query string with the application/x-www-form-urlencoded parser of the WHATWG URL Standard, so that %40sort and @sort are the same key and + is a space.
4.2 Keys
Section titled “4.2 Keys”QS_CONTROL_PREFIX MUST
A key starting with @ MUST be interpreted as a control parameter, never as a field condition. Control parameters are defined by this specification (@q) or by the specification of the protocol that uses UnQuery.
QS_CONTROL_UNKNOWN MUST
A key starting with @ that is not a defined control parameter MUST NOT be interpreted as a condition. An implementation MUST report it as an error, unless the protocol specification that uses UnQuery defines another handling, such as reporting it as a warning.
QS_KEY_PATH MUST
Any other key MUST be a field path as defined in PATH_DOT_NOTATION, and an implementation MUST fail on keys that are not, except for keys in its ignore list (QS_IGNORE_LIST).
QS_IGNORE_LIST MAY
An implementation MAY exclude keys from filtering, either because it is configured with a list of keys to ignore (such as utm_source) or because the protocol specification that uses UnQuery assigns them another meaning (such as the parameters of a saved query). Excluded keys are neither conditions nor errors.
4.3 Values
Section titled “4.3 Values”Values are interpreted by trying each syntax in order, so that common cases need no extra characters.
QS_VALUE_ORDER MUST
A query string value MUST be interpreted as the first of the following that parses successfully: (1) a JSON text (RFC 8259); (2) a SQL syntax predicate tail, that is, the tail rule of section 3.1 with the key as the field; (3) otherwise, a string literal. Forms (1) and (3) are conditions with the eq operator, unless the JSON text is an operator object (section 2).
QS_VALUE_COMMITTED MUST
Once a value parses as a JSON text, or as a SQL syntax predicate tail, any later error, such as a mixed operator object, an unknown operator, an invalid ECSON value or an invalid typed literal, MUST make the filter fail. The value MUST NOT fall back to the next form.
| Query string | Condition |
|---|---|
?age=30 |
eq(age, 30), a number |
?active=true |
eq(active, true), a boolean |
?name=Ana |
eq(name, "Ana"), a string |
?zip="01234" |
eq(zip, "01234"), a string (quoted JSON) |
?zip=01234 |
eq(zip, "01234"), a string (not valid JSON, not SQL) |
?age=BETWEEN 18 AND 30 |
and(gte(age, 18), lte(age, 30)) |
?status=IN ('paid', 'shipped') |
in(status, ["paid", "shipped"]) |
?total={"@gte":100} |
gte(total, 100), an operator object (section 2) |
?deletedAt=null |
eq(deletedAt, null): null or missing |
?address.city=Recife |
eq(address.city, "Recife") |
?Customer%20name=Ana |
eq("Customer name", "Ana") |
?%22Total.value%22=%3E10 |
gt("Total.value", 10) |
4.4 Combining conditions
Section titled “4.4 Combining conditions”QS_COMBINE_AND MUST
All conditions in a query string, including repeated keys and the filter in @q, MUST be combined with and.
4.5 Control parameter @q
Section titled “4.5 Control parameter @q”@q carries a complete filter, for conditions that per-key parameters cannot express, such as or across fields, or fields whose names would need escaping.
QS_Q_FILTER MUST
The value of @q MUST be interpreted as the first of the following that parses successfully: (1) a JSON filter (section 2); (2) a SQL syntax filter (the filter rule of section 3.1). An implementation MUST fail if neither parses.
Source: lingodata/unquery@865de91 · spec/sections/04-query-string.md · unquery 0.1.0 (draft)
LingoData specifications, reference implementations and this site are licensed under the Apache License 2.0. Copyright 2026 Gustavo Gondim.