This node module provides robust querystring parsing and stringifying. It is based heavily on the YUI QueryString module located here.
Thanks to Isaac Schlueter for pointing me to the YUI code and allowing me to tweak it for node.js.
Exports the parse and stringify methods from the querystring-parse and querystring-stringify sub-modules, repsectively.
var sys = require("util");
var qs = require("./querystring");
var str = qs.parse("foo=bar&baz=qux");
sys.puts(JSON.stringify(str)); // => {"foo":"bar","baz":"qux"}
str = qs.parse("foo[bar][][bla]=baz");
sys.puts(JSON.stringify(str)); // => {"foo":{"bar":[{"bla":"baz"}]}}
var sys = require("util");
var qs = require("./querystring");
var obj = {"foo":"bar","baz":"qux"};
sys.puts(qs.stringify(obj)); // => foo=bar&baz=qux
obj = {"foo":{"bar":[{"bla":"baz"}]}};
sys.puts(qs.stringify(obj)); // => foo%5Bbar%5D%5B%5D%5Bbla%5D=baz
Provides a parse function which takes a string and returns a javascript object
Provides a stringify function which takes a javascript object and returns a query string
See test.js for a few more examples.