I think this should be fairly simple - you should be able to do it the same way you would do in a browser. This function converts all string/number members of an object/array to a string that can be used as a POST body:
var objectToPostBody = function (object) {
var i, out;
if (!object) {
return false;
}
out = [];
for (i in object) {
if (typeof object[i] === 'string' || typeof object[i] === 'number') {
out[out.length] = encodeURIComponent(i) + '=' + encodeURIComponent(object[i]);
}
}
return out.join('&');
};
If you want to handle sub-arrays/sub-objects the function would get more complicated, but for what you describe above I think that should do the trick.