Filter strategy and strict compliance

Per the specification:

The filter query parameter is reserved for filtering data. Servers and clients SHOULD use this key for filtering operations.

Reviewing prior discussions, I see a lot of people proposing methods like these:

?filter[foo]=1
?filter[foo][bar]=2
?filter[foo]=1&filter[bar]=2
?filter[foo]=1;[bar]=2

Is there any standard in effect for what exactly a “query parameter” is? (I know ampersand separated name=value pairs is quasi-standard but I’m not sure if it is formalized anywhere). Is it correct to say that, e.g.,:

filter[foo]=1

Is a “filter query parameter”?

It seems reasonable to argue that this is actually a “filter[foo] query parameter” and thus not following the recommendation. I know some frameworks parse this kind of thing into a map like {filter: {foo: 1}}. Is that something the specification assumes?

Before I solidify what my filter syntax will be I’d like to be sure that some or all of the above examples are actually in line with the recommendation in the specification.

Thanks!

Maybe the standard we’re assuming is the W3C standard for x-www-form-urlencoded form submission processing, in which case:

If string contains a “=” (U+003D) character, then let name be the substring of string from the start of string up to but excluding its first “=” (U+003D) character,

So, strictly speaking a “filter query parameter” must be filter=....

I think I’ll just assume that’s what the spec means to be safe.

Aaaand final followup here:

http://jsonapi.org/recommendations/#filtering

Since this is explicitly a recommendation I’m going to assume the spec allows for it.

I apologize for the delayed response.

The query parameter is defined in RFC3986, and you’ll see other mention to the & as the sub delimiter elsewhere in the spec.

The URL needs to be percent encoded, not urlencoded.

Your strategy for the filter may work, however as a framework designer and developer I caution you against backing yourself in a corner with such a constraining data structure choice as a flat map. It may be more beneficial to use an array (of one) simply to have the flexibility down the line, as multiple filters of the same name wouldn’t necessarily be an unheard of event. e.g. foo > 10 && foo < 60.

Good luck, hope that helps!