troch / path-parser

A small utility to parse paths.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object query parameters

alexahn opened this issue · comments

Would it be possible to get object query parameter support? A common way to support this is using brackets (e.g. express and jQuery):

http://localhost/page?a[b]=10

which serializes into the query parameters: { a: { b: 10 } }. Given the library supports array query parameters, I think object query parameter support would be a natural evolution. Here's a reasonable implementation: http://api.jquery.com/jquery.param/
It would be fantastic if we could get functionality similar to:

$.param({ a: { b: 1, c: 2 }, d: [ 3, 4, { e: 5 } ] });
// "a[b]=1&a[c]=2&d[]=3&d[]=4&d[2][e]=5"

Last, I would have done this myself if possible, but the regex rules defined in the library are too strict, and are unable to match, for example, ?a[b]=10.

Apologies for the late response, I'm in the middle of working on the next release of router5, but will support this when I'm done.