Skip to content

A straight forward ruby gem to convert nested and intermingled hashes and arrays to http query strings.

Notifications You must be signed in to change notification settings

simen/queryparams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QueryParams

A straight forward gem to convert ruby hashes and arrays to http query strings following the query string conventions of Rails and Sinatra. It supports hashes, arrays, nested hashes and arrays of hashes and all combinations thereof. E.g.:

QueryParams.encode({a: 1, b: "c"})
=> "a=1&b=c"

QueryParams.encode({a: {b: 'c', d: 'e'}, f: 'g'})
=> "a[b]=c&a[d]=e&f=g"

QueryParams.encode({a: ['bingo', 'hepp']})
=> "a[0]=bingo&a[1]=hepp"

QueryParams.encode({a: [{b:'c', d:'e'}, {b:'g'}]})
=> "a[][b]=c&a[][d]=e&a[][b]=g"

About

A straight forward ruby gem to convert nested and intermingled hashes and arrays to http query strings.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages