jQuery .serializeArray() Method

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Ajax Utilities

What You’ll Learn

.serializeArray() returns form data as an array of { name, value } objects instead of a query string. This tutorial covers the no-argument signature, W3C successful-control rules, iterating with $.each(), equivalence with .serialize() via $.param(), transforming fields before Ajax, building plain objects for JSON APIs, and when to prefer each serialization method.

01

Object Array

{ name, value }

02

Successful

Same as serialize

03

$.each()

Iterate fields

04

$.param()

→ query string

05

Transform

Edit before send

06

JSON

Map to object

Introduction

.serialize() gives you one URL-encoded string — perfect for $.post(), but awkward when you need to rename a field, drop empty values, or inspect each input separately. .serializeArray() returns structured data instead: an array where every successful control becomes { name: "fieldName", value: "fieldValue" }.

That array is what jQuery passes to $.param() inside .serialize(). Exposing it directly lets you modify the list, convert it to JSON, or build a plain object before sending. Same successful-control rules apply — only named, enabled, checked-as-required fields appear.

Understanding .serializeArray()

.serializeArray() is a collection method that accepts no arguments and returns an Array of plain objects. Each object has exactly two properties: name (string) and value (string). Empty arrays are valid when no successful controls exist.

The method uses W3C rules for successful controls — identical to .serialize(). Multi-select options produce one object per selected option with the same name. Checkboxes without a value attribute serialize as value: "on" when checked.

💡
Beginner Tip

Log the array during development: console.log( JSON.stringify( $( "form" ).serializeArray(), null, 2 ) ). When you are ready to POST, either call $.param( array ) or switch to .serialize() if no transforms are needed.

📝 Syntax

Collection method — .serializeArray()

jQuery
jQuery( formElements ).serializeArray()

Sample return value

jQuery
[
  { name: "a", value: "1" },
  { name: "b", value: "2" },
  { name: "c", value: "3" }
]

Relationship to .serialize() and $.param()

jQuery
var arr = $( "form" ).serializeArray();

// Same string as .serialize() when array is unchanged:
$.param( arr ) === $( "form" ).serialize();

Return value

  • Returns an Array — not a jQuery object, not a string.
  • Each element is { name: String, value: String }.
  • Re-wrap the form with $() if you need jQuery chaining after calling this method on a stored reference.

⚡ Quick Reference

GoalCode
Serialize form to array$("form").serializeArray()
Log as JSONJSON.stringify($("form").serializeArray(), null, 2)
Iterate fields$.each(arr, function(i, field) { ... })
Convert to query string$.param($("form").serializeArray())
Build plain objectObject.fromEntries(arr.map(f => [f.name, f.value]))
Filter empty valuesarr.filter(function(f) { return f.value.trim(); })
POST after transform$.post(url, $.param(modifiedArray))
On submit handlerconsole.log($(this).serializeArray())
Need string onlyUse .serialize() instead

📋 .serializeArray() vs .serialize() vs FormData vs manual loop

Four ways to read form data — pick based on output shape and whether you need files or transforms.

.serializeArray()
[{ name, value }]

Structured array — iterate, filter, map; pass to $.param() for query strings

.serialize()
query string

One-liner URL-encoded string — $.param(serializeArray()) under the hood

FormData
native + files

new FormData(form) — includes file inputs; use with $.ajax processData:false

Manual loop
:input each

$(":input").each(...) — full control but reinvents successful-control rules

Use .serializeArray() when you need structured access to each field. Use .serialize() for direct Ajax POST strings. Use FormData for file uploads. Avoid manual loops unless you have unusual control types.

Examples Gallery

Five progressive examples from a basic array on submit through official-style iteration, $.param equivalence, field transforms, and mapping to a JSON-friendly object. Each links to a Try-it lab.

📚 Core Patterns

Read form values as a name/value array.

Example 1 — Basic .serializeArray() on submit

Official pattern: log the array inside a submit handler with preventDefault.

jQuery
$( "form" ).on( "submit", function( event ) {
  event.preventDefault();

  var fields = $( this ).serializeArray();
  $( "#json-out" ).text( JSON.stringify( fields, null, 2 ) );

  console.log( fields );
  // [ { name: "username", value: "john" }, { name: "email", value: "..." } ]
} );
Try It Yourself

How It Works

Unlike .serialize(), you receive structured data immediately — no parsing required. Display with JSON.stringify for debugging or pass the array to your own logic.

Example 2 — Official demo — iterate with $.each()

Adapted from the jQuery API docs: rebuild a live results display from serialized field values.

jQuery
function showValues() {
  var fields = $( ":input" ).serializeArray();
  $( "#results" ).empty();

  jQuery.each( fields, function( i, field ) {
    $( "#results" ).append(
      $( "<span>" ).text( field.name + "=" + field.value ).css( "margin-right", "8px" )
    );
  } );
}

$( ":checkbox, :radio, select" ).on( "click change", showValues );
showValues();
Try It Yourself

How It Works

The official demo selects :input controls directly. Inside a <form>, prefer $( "form" ).serializeArray() to avoid duplicate entries from nested selections.

Example 3 — $.param( serializeArray() ) equals .serialize()

Prove the internal pipeline — modify the array only when you need to.

jQuery
var $form = $( "#demo-form" );

var fromArray = $.param( $form.serializeArray() );
var fromSerialize = $form.serialize();

$( "#match" ).text( fromArray === fromSerialize ? "Match!" : "Mismatch" );
$( "#string" ).text( fromSerialize );

// decodeURIComponent for human-readable debug:
console.log( decodeURIComponent( fromSerialize ) );
Try It Yourself

How It Works

This equivalence is why the $.param() tutorial matters for forms — .serialize() is literally $.param( .serializeArray() ).

📈 Transform & JSON

Modify the array or convert shape before sending.

Example 4 — Transform array before $.post()

Filter empty values and append a hidden token — impossible with bare .serialize() without string hacking.

jQuery
$( "#save" ).on( "click", function() {
  var data = $( "#profile-form" ).serializeArray();

  // Drop empty optional fields
  data = data.filter( function( field ) {
    return field.value.trim() !== "";
  } );

  // Append CSRF token
  data.push( { name: "_token", value: "abc123" } );

  $.post( "/api/profile", $.param( data ), function( response ) {
    console.log( "Saved", response );
  } );
} );
Try It Yourself

How It Works

Arrays are mutable — push, filter, and map before encoding. This is the main reason to choose .serializeArray() over .serialize().

Example 5 — Map array to plain object for JSON APIs

Convert name/value pairs into an object for JSON.stringify and contentType: "application/json".

jQuery
function arrayToObject( fields ) {
  var obj = {};
  fields.forEach( function( field ) {
    obj[ field.name ] = field.value;
  } );
  return obj;
}

var payload = arrayToObject( $( "#signup-form" ).serializeArray() );

$.ajax( {
  url: "/api/signup",
  method: "POST",
  contentType: "application/json",
  data: JSON.stringify( payload )
} );
Try It Yourself

How It Works

Simple forEach mapping works for flat forms. Multi-select and duplicate names need a smarter reducer — or stay with $.param() for form-encoded POST.

🚀 Common Use Cases

  • Debug forms — inspect exact name/value pairs before Ajax submission.
  • Field filtering — remove empty optional inputs or internal-only fields.
  • Add hidden tokens — push CSRF or session values into the array before $.param().
  • Custom validation UI — iterate and highlight fields by field.name.
  • JSON API bridge — map array to object then JSON.stringify.
  • Multi-step wizards — merge arrays from partial forms before one POST.

🧠 How .serializeArray() Works Internally

1

Resolve control set

If matched element is a <form>, gather successful controls inside it. Otherwise serialize controls in the jQuery set.

controls
2

Apply W3C rules

Named, enabled controls only. Checked boxes/radios. Skip files. Empty value → "".

filter
3

Build object array

Push { name, value } for each control. Multi-select adds one object per selected option.

array
4

Return Array

Hand back plain JavaScript array — mutate, iterate, or pass to $.param().

output
5

Optional $.param()

.serialize() calls $.param() on this array unchanged. You can transform first.

$.param()
6

Ajax or JSON transport

Encode with $.param() for form POST, map to object for JSON, or consume array directly in app logic.

📝 Notes

  • .serializeArray() accepts no arguments and returns an Array.
  • Same successful-control rules as .serialize() — see the .serialize() tutorial.
  • .serialize() === $.param( .serializeArray() ) when the array is unmodified.
  • Duplicate name keys are valid — multi-select and repeated fields produce multiple objects.
  • Simple object mapping loses duplicate names — last value wins; use arrays or $.param().
  • File inputs never appear — use FormData for uploads.
  • Available since jQuery 1.2 — one release after .serialize() (1.0).

Browser Support

.serializeArray() is part of jQuery’s core form helpers — not a native DOM API. It works wherever jQuery runs: all browsers supported by your jQuery version.

jQuery 1.2+

jQuery .serializeArray() method

Supported in jQuery 1.x, 2.x, and 3.x across all modern browsers and IE with supported jQuery builds. HTML5 input types follow the same successful-control rules as .serialize().

100% With jQuery
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
.serializeArray() Universal

Bottom line: Safe in any jQuery project with forms. Pair with $.param() for query strings or map to objects for JSON APIs.

Conclusion

.serializeArray() is the structured sibling of .serialize() — same successful controls, but an array of { name, value } objects you can iterate, filter, and transform. Encode with $.param() when you need a query string, or map to a plain object for JSON APIs.

Continue with the ajaxStart event tutorial to show loading indicators while form Ajax requests run, or review the jQuery .serialize() tutorial for the one-line string shortcut.

💡 Best Practices

✅ Do

  • Use .serializeArray() when you need to modify fields before sending
  • Select $( "form" ) for standard forms — avoid duplicate entries
  • Pass transformed arrays through $.param() for form-encoded POST
  • Log with JSON.stringify during development
  • Fall back to .serialize() when no transforms are needed

❌ Don’t

  • Assume simple object mapping handles duplicate field names
  • Expect file inputs in the array — use FormData
  • Forget unchecked checkboxes are omitted entirely
  • Mutate the array then expect .serialize() to match — re-call or use $.param
  • Send raw array as POST body without encoding — servers expect strings or JSON

Key Takeaways

Knowledge Unlocked

Six things to remember about .serializeArray()

Form in, object array out.

6
Core concepts
ok 02

Same Rules

As .serialize()

Controls
each 03

$.each()

Iterate fields

Loop
pr 04

$.param()

→ query string

Encode
edit 05

Transform

Filter/push

Mutate
{ } 06

JSON map

Plain object

API

❓ Frequently Asked Questions

jQuery .serializeArray() is a collection method that encodes successful form controls as an array of plain objects — each with name and value properties. Call $("form").serializeArray() to get [{ name: "email", value: "a@b.com" }, ...]. It accepts no arguments and returns an Array, not a string. Use it when you need to inspect, filter, or transform individual fields before sending data.
.serializeArray() returns an array of { name, value } objects. .serialize() returns the same data encoded as one URL query string via $.param(). They use identical successful-control rules. Use .serializeArray() when you need per-field logic; use .serialize() when you already want a string for $.post() or query URLs. Note: $(form).serialize() equals $.param($(form).serializeArray()).
Same rules as .serialize() and native HTML forms: each control must have a name attribute and must not be disabled. Checkboxes and radios appear only when checked. File inputs are excluded. Submit button values are not included. Controls without a value attribute use an empty string.
Yes — that is exactly what .serialize() does internally. $.param($("form").serializeArray()) produces the same URL-encoded string as $("form").serialize(). After .serializeArray(), you can modify the array (add, remove, or change entries) and then call $.param() on the result for a custom query string.
The array structure is JSON-serializable — JSON.stringify($("form").serializeArray()) produces valid JSON. Many REST APIs expect a flat object instead; map the array with a reduce or loop. For JSON APIs, building a plain object or using FormData may be clearer than a name/value array.
Select the form element: $("form").serializeArray(). jQuery finds successful controls inside the form. Selecting both form and its inputs in one set can duplicate entries. You may select individual inputs when they are not inside a form wrapper.
Did you know?

.serializeArray() arrived in jQuery 1.2 — one release after .serialize(). The array format is exactly what $.param() accepts, which is why jQuery could add structured access without changing the wire format. The official API docs demo uses $.each() on the array to append each field.value to a results div — the same live-preview pattern as the .serialize() tutorial, but with structured objects instead of parsing a query string.

Next: ajaxStart Event

Hook into global Ajax lifecycle events — show a loading overlay when form requests start.

ajaxStart tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful