jQuery.param(obj [, traditional]) creates a serialized, URL-encoded string from an array, plain object, or jQuery form collection (since 1.2; traditional since 1.4). Use it for query strings and Ajax data.
Remember
$.param({ width: 1680, height: 1050 });
// "width=1680&height=1050"
$.param({ a: [2, 3, 4] }); // "a[]=2&a[]=3&a[]=4" (1.4+)
$.param({ a: [2, 3, 4] }, true); // "a=2&a=3&a=4" (traditional)
// Used internally by $.ajax() / $.get() / $.post() when data is an object
Pass data in, get a query string out — then append it to a URL or let Ajax helpers encode for you.
Build a plain object, a serializeArray()-style array, or select form inputs.
Call $.param(obj) for recursive encoding (default).
Pass true as the second argument for traditional shallow encoding.
Append the result after ?, or pass the object to $.get() / $.post() directly.
Use decodeURIComponent() when you need a readable debug view.
Piece
Required?
Role
obj
Yes
Plain object, name/value array, or jQuery form collection
traditional
Optional
true = shallow; default false = recursive (1.4+)
Return value
—
URL-encoded string (key=value&…)
Pseudocode
Pseudocode
call $.param(obj [, traditional])
if obj is a jQuery collection:
treat as form inputs (name/value)
if obj is [{ name, value }, …]:
encode each pair as name=value
if obj is a plain object:
if traditional is true:
shallow encode (nested objects → "[object Object]")
arrays → repeated keys without []
else:
recursively walk nested keys
arrays → name[]=value
objects → name[key]=value
return joined "key=value" pairs with "&"
(URL-encode keys and values)
Reference
Cheat Sheet
Keep these facts handy while building query strings.
Topic
Detail
Signature
$.param(obj [, traditional])
Returns
String (URL-encoded query)
Since
1.2 · traditional 1.4 · 3.0 default always false
Arrays (default)
a[]=2&a[]=3
Arrays (traditional)
a=2&a=3
Functions as values
Since 1.3 — return value is used, not the function string
Form helper
$.param($("form").serializeArray())
Debug
decodeURIComponent($.param(obj))
Try it
Live Preview
Serialize sample data and compare recursive vs traditional output.
Runs entirely in the browser — no network required.
Result
Ready — pick an action and click Run.
Code
jQuery Examples
Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.
Example 1 — Basic Key/Value Object
Official demo pattern: serialize a simple object and display it.
jQuery
var params = { width: 1680, height: 1050 };
var str = $.param(params);
$("#results").text(str);
// "width=1680&height=1050"
Ajax. Passing data to $.get() uses the same encoder.
Arrays. Tags become tags[]=… with the default mode.
Edge Cases & Pitfalls
Check these before shipping query-string payloads.
nested
Objects inside arrays are fragile
Server frameworks parse deep nesting differently. Prefer flat data or JSON for complex shapes.
traditional
Pass traditional explicitly (3.0+)
Do not rely on jQuery.ajaxSettings.traditional — defaults always start at false now.
shallow
Traditional turns objects into [object Object]
Nested objects are not recursively expanded when traditional is true.
json
No universal param-string spec
For complex structures, send JSON (contentType: "application/json") instead of deep param encoding.
Compatibility
Browser Support
$.param() has been part of jQuery since 1.2 (traditional since 1.4). It works wherever your loaded jQuery version runs. Prefer a current jQuery 3.x build for modern projects.
✓ Stable · jQuery 1.2+
jQuery.param()
Works in every browser that runs your loaded jQuery version. Encoding is done in JavaScript — no special browser API required.
100%With jQuery
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
$.param()Universal
Bottom line: Safe for everyday query strings. Prefer recursive encoding for modern backends, and pass traditional explicitly when you need shallow mode.
Analysis
Performance Notes
Approach
Cost
Best for
Flat object $.param()
Cheap
Filters, pagination, simple forms
Deep recursive nesting
Higher
Only when the server expects brackets
JSON request body
Clearer
Complex nested payloads
Encoding small objects is inexpensive. Cost grows with deep trees and large arrays — keep payloads flat when you can.
Remember
Key Takeaways
Role: turn objects/arrays into URL-encoded query strings.
Default: recursive brackets (a[]=1, a[b]=2) since 1.4.
Forms:$.param($("form").serializeArray()) bridges DOM → query.
Complex data: prefer JSON over deep param nesting.
One line:$.param() is jQuery’s object-to-query-string encoder for Ajax and URLs.
Frequently Asked Questions
jQuery.param() creates a URL-encoded query string from a plain object, an array of name/value pairs (like .serializeArray() returns), or a jQuery collection of form inputs. The string is suitable for a URL query or Ajax data. jQuery uses it internally when you pass an object to the data option of $.ajax(), $.get(), or $.post().
By default (traditional false), $.param() recursively encodes nested objects and arrays with bracket notation — e.g. a[one]=1&b[]=2. With traditional true, serialization is shallow: nested objects become [object Object] and arrays use repeated keys without brackets. Prefer recursive for PHP, Rails, and most modern backends.
.serialize() on a form returns a ready-made query string. .serializeArray() returns [{ name, value }, …]. $.param() is the lower-level encoder — you can pass that array: $.param($("form").serializeArray()). Use param() when your data is already a JavaScript object.
Before 1.4, $.param({ a: [2, 3, 4] }) produced a=2&a=3&a=4. From 1.4 onward the default is a[]=2&a[]=3&a[]=4 so PHP and Rails can rebuild arrays. Pass traditional: true for the old repeated-key behavior.
No. There is no universal param-string spec across languages. Deep nesting (objects inside arrays) can parse differently on different servers. For complex payloads prefer JSON in the request body.
Before jQuery 3.0, $.param() could inherit jQuery.ajaxSettings.traditional. Since 3.0, traditional defaults to false unless you pass true. For cross-version compatibility, pass the second argument explicitly when you need shallow serialization.